1 | | == CLEAN HARD UPGRADE ON WINDOWS == |
2 | | General Hard upgrade instructions are documented in [http://www.postgis.org/documentation/manual-svn/postgis_installation.html#hard_upgrade PostGIS Hard Upgrade] |
3 | | |
4 | | You need to do a hard upgrade if you are using a pre-alpha release of a major release such as the case with PostGIS 2.0 |
5 | | or you are upgrading from one major version to another e.g 0.*, 1.* --> 2.* |
6 | | |
7 | | 1. Create a backup of your postgis database as usual. You can do this with pg_dump as that instructions describe or !PgAdmin by right-clicking on the database -> Backup. Make sure to use "Custom" backup for format if you are using !PgAdmin III. |
8 | | 2. Create a new postgis database installed with the postgis version you want to upgrade to. Note if you are using PostgreSQL 9.1 and PostGIS 2.0 -- you can use the new in psql or pgAdmin III sql window after you have created a new database |
9 | | to spatially enable it or right-clicking Extensions in pgAdmin III to install the extensions. |
10 | | |
11 | | {{{ |
12 | | CREATE EXTENSION postgis; |
13 | | CREATE EXTENSION postgis_topology |
14 | | }}} |
15 | | |
16 | | |
17 | | 3. If you don't have perl on your windows box, download [http://www.activestate.com/activeperl/downloads ActivePerl] and install. You can use the 64-bit or 32-bit version even if you are using 32-bit PostgreSQL. [http://www.activestate.com/activeperl/downloads]. |
18 | | When prompted to do so, choose to add Perl to your environment path and map perl to .pl scripts. |
19 | | |
20 | | Note that ActivePerl also has packages for MacOS, Linux, but is generally not necessary for those platforms since they come prepackaged with perl. |
21 | | |
22 | | 4. Create an upgrade.bat file with contents something like this: |
23 | | {{{ |
24 | | set PGPORT=5432 |
25 | | set PGHOST=localhost |
26 | | set PGUSER=postgres |
27 | | set PGPASSWORD=yourpasswordhere |
28 | | set THEDB=mydb |
29 | | set PGINSTALL=C:\Program Files (x86)\PostgreSQL\9.1 |
30 | | REM note the below example is if you are on 32-bit windows choose which install path makes most sense |
31 | | REM set PGINSTALL=C:\Program Files\PostgreSQL\9.1\ |
32 | | set PATH=%PATH%;"%PGINSTALL%\bin\" |
33 | | perl utils/postgis_restore.pl "mydb.backup" | psql %THEDB% 2> errors.txt |
34 | | pause |
35 | | }}} |
36 | | |
37 | | 5. Edit the script accordingly to your path settings. Note that utils folder is packaged with the PostGIS tar balls |
38 | | if not present in your PostGIS install. Download the tar ball for the PostGIS you want to upgrade too. [http://www.postgis.org/download/] |
39 | | |
40 | | 6. Right mouse click on the .bat file (you may have to choose -- Run as Administrator) |
41 | | |
42 | | 7. If all is working -- you should see a screen something like: |
43 | | |
44 | | {{{ |