marmotta-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sschaff...@apache.org
Subject git commit: added scripts to allow schema update from Marmotta 3.0
Date Fri, 24 May 2013 15:53:37 GMT
Updated Branches:
  refs/heads/develop f786c0621 -> 91897fd32


added scripts to allow schema update from Marmotta 3.0


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/91897fd3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/91897fd3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/91897fd3

Branch: refs/heads/develop
Commit: 91897fd322d56fccf47cfa60934ead41f97405c4
Parents: f786c06
Author: Sebastian Schaffert <sschaffert@apache.org>
Authored: Fri May 24 17:53:21 2013 +0200
Committer: Sebastian Schaffert <sschaffert@apache.org>
Committed: Fri May 24 17:53:21 2013 +0200

----------------------------------------------------------------------
 .../marmotta/kiwi/persistence/KiWiDialect.java     |    4 ++--
 .../kiwi/persistence/h2/create_base_tables.sql     |    2 +-
 .../kiwi/persistence/h2/upgrade_base_001_002.sql   |    1 +
 .../persistence/mysql/upgrade_base_001_002.sql     |    1 +
 .../kiwi/persistence/pgsql/create_base_tables.sql  |    2 +-
 .../persistence/pgsql/upgrade_base_001_002.sql     |    1 +
 .../persistence/h2/upgrade_ldcache_001_002.sql     |    4 ++++
 .../persistence/mysql/upgrade_ldcache_001_002.sql  |    4 ++++
 .../persistence/pgsql/upgrade_ldcache_001_002.sql  |    4 ++++
 9 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/91897fd3/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/persistence/KiWiDialect.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/persistence/KiWiDialect.java
b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/persistence/KiWiDialect.java
index 0d66088..0c9b2a8 100644
--- a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/persistence/KiWiDialect.java
+++ b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/persistence/KiWiDialect.java
@@ -36,7 +36,7 @@ public abstract class KiWiDialect {
 
     private static Logger log = LoggerFactory.getLogger(KiWiDialect.class);
 
-    private final static int VERSION = 1;
+    private final static int VERSION = 2;
 
     private Properties statements;
 
@@ -112,7 +112,7 @@ public abstract class KiWiDialect {
         StringBuilder builder = new StringBuilder();
         for(int i = oldVersion+1; i <= VERSION; i++ ) {
             try {
-                String script = String.format("upgrade_"+name+"_%02d_%02d.sql",i-1,i);
+                String script = String.format("upgrade_"+name+"_%03d_%03d.sql",i-1,i);
 
                 builder.append(IOUtils.toString(this.getClass().getResourceAsStream(script)));
             } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/91897fd3/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/create_base_tables.sql
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/create_base_tables.sql
b/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/create_base_tables.sql
index 0e4fed5..66c2ad1 100644
--- a/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/create_base_tables.sql
+++ b/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/create_base_tables.sql
@@ -79,5 +79,5 @@ CREATE INDEX idx_namespaces_uri ON namespaces(uri);
 CREATE INDEX idx_namespaces_prefix ON namespaces(prefix);
 
 -- insert initial metadata
-INSERT INTO metadata(mkey,mvalue) VALUES ('version','1');
+INSERT INTO metadata(mkey,mvalue) VALUES ('version','2');
 INSERT INTO metadata(mkey,mvalue) VALUES ('created',FORMATDATETIME(now(),'yyyy-MM-dd HH:mm:ss
z','en') );
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/91897fd3/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/upgrade_base_001_002.sql
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/upgrade_base_001_002.sql
b/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/upgrade_base_001_002.sql
new file mode 100644
index 0000000..ac32460
--- /dev/null
+++ b/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/upgrade_base_001_002.sql
@@ -0,0 +1 @@
+UPDATE METADATA SET mvalue = '2' WHERE mkey = 'version';
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/91897fd3/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/upgrade_base_001_002.sql
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/upgrade_base_001_002.sql
b/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/upgrade_base_001_002.sql
new file mode 100644
index 0000000..d72f1eb
--- /dev/null
+++ b/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/upgrade_base_001_002.sql
@@ -0,0 +1 @@
+UPDATE metadata SET mvalue = '2' WHERE mkey = 'version';
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/91897fd3/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/create_base_tables.sql
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/create_base_tables.sql
b/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/create_base_tables.sql
index d60fdc7..42a143c 100644
--- a/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/create_base_tables.sql
+++ b/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/create_base_tables.sql
@@ -83,5 +83,5 @@ CREATE INDEX idx_namespaces_prefix ON namespaces(prefix);
 -- a function for cleaning up table rows without incoming references
 
 -- insert initial metadata
-INSERT INTO metadata(mkey,mvalue) VALUES ('version','1');
+INSERT INTO metadata(mkey,mvalue) VALUES ('version','2');
 INSERT INTO metadata(mkey,mvalue) VALUES ('created',to_char(now(),'yyyy-MM-DD HH:mm:ss TZ')
);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/91897fd3/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_base_001_002.sql
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_base_001_002.sql
b/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_base_001_002.sql
new file mode 100644
index 0000000..ac32460
--- /dev/null
+++ b/libraries/kiwi/kiwi-triplestore/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_base_001_002.sql
@@ -0,0 +1 @@
+UPDATE METADATA SET mvalue = '2' WHERE mkey = 'version';
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/91897fd3/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/upgrade_ldcache_001_002.sql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/upgrade_ldcache_001_002.sql
b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/upgrade_ldcache_001_002.sql
new file mode 100644
index 0000000..5a51ec9
--- /dev/null
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/h2/upgrade_ldcache_001_002.sql
@@ -0,0 +1,4 @@
+ALTER TABLE ldcache_entries ADD COLUMN triple_count int NOT NULL DEFAULT 0;
+UPDATE
+  ldcache_entries
+SET triple_count = (SELECT count(*) as numTriples FROM triples WHERE subject = ldcache_entries.resource_id
and deleted = false)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/91897fd3/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/upgrade_ldcache_001_002.sql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/upgrade_ldcache_001_002.sql
b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/upgrade_ldcache_001_002.sql
new file mode 100644
index 0000000..5a51ec9
--- /dev/null
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/mysql/upgrade_ldcache_001_002.sql
@@ -0,0 +1,4 @@
+ALTER TABLE ldcache_entries ADD COLUMN triple_count int NOT NULL DEFAULT 0;
+UPDATE
+  ldcache_entries
+SET triple_count = (SELECT count(*) as numTriples FROM triples WHERE subject = ldcache_entries.resource_id
and deleted = false)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/91897fd3/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_ldcache_001_002.sql
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_ldcache_001_002.sql
b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_ldcache_001_002.sql
new file mode 100644
index 0000000..5a51ec9
--- /dev/null
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/resources/org/apache/marmotta/kiwi/persistence/pgsql/upgrade_ldcache_001_002.sql
@@ -0,0 +1,4 @@
+ALTER TABLE ldcache_entries ADD COLUMN triple_count int NOT NULL DEFAULT 0;
+UPDATE
+  ldcache_entries
+SET triple_count = (SELECT count(*) as numTriples FROM triples WHERE subject = ldcache_entries.resource_id
and deleted = false)
\ No newline at end of file


Mime
View raw message