modified script to upgrade 4 to 5 db version. Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/d3c5e0b4 Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/d3c5e0b4 Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/d3c5e0b4
Branch: refs/heads/MARMOTTA-584 Commit: d3c5e0b476f2774e95694dff5a927d2b44313949 Parents: 0acf49b Author: cuent <[email protected]> Authored: Tue Aug 11 01:04:38 2015 -0500 Committer: cuent <[email protected]> Committed: Tue Aug 11 01:04:38 2015 -0500 ---------------------------------------------------------------------- .../persistence/pgsql/upgrade_base_004_005.sql | 23 ++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/d3c5e0b4/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_base_004_005.sql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_base_004_005.sql b/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_base_004_005.sql index 8408946..fdf2b4c 100644 --- a/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_base_004_005.sql +++ b/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_base_004_005.sql @@ -13,11 +13,30 @@ -- See the License for the specific language governing permissions and -- limitations under the License. ---add geom nodetype + +--creating new type 'geom' +-- 1. rename the enum type +alter type nodetype rename to nodetype_old; +-- 2. create new type CREATE TYPE nodetype AS ENUM ('uri','bnode','string','int','double','date','boolean','geom'); +-- 3. rename column(s) which uses our enum type +alter table nodes rename column ntype to ntype_old; +-- 4. add new column of new type +alter table nodes add ntype nodetype; +-- 5. copy values to the new column +update nodes set ntype = ntype_old::text::nodetype; +-- 6. remove old column and type +alter table nodes drop column ntype_old; + +-- 3. delete old enum type +drop type nodetype_old; + + +--ALTER TYPE nodetype ADD VALUE 'geom' AFTER 'boolean'; + --necessary for use spatial queries -CREATE EXTENSION postgis; +CREATE EXTENSION IF NOT EXISTS POSTGIS; --adding geometry colum ALTER TABLE nodes ADD COLUMN gvalue geometry;
