Browse Source

[1756] Bump schema version to 2.2 and update dbutil

Mukund Sivaraman 12 years ago
parent
commit
c00795e0f9

+ 7 - 1
src/bin/dbutil/dbutil.py.in

@@ -200,10 +200,16 @@ UPGRADES = [
             "CREATE INDEX nsec3_byhash_and_rdtype ON nsec3 " +
                 "(hash, rdtype)"
         ]
+    },
+
+    {'from': (2, 1), 'to': (2, 2),
+        'statements': [
+            "CREATE INDEX records_byrname_and_rdtype ON records (rname, rdtype)"
+        ]
     }
 
 # To extend this, leave the above statements in place and add another
-# dictionary to the list.  The "from" version should be (2, 1), the "to"
+# dictionary to the list.  The "from" version should be (2, 2), the "to"
 # version whatever the version the update is to, and the SQL statements are
 # the statements required to perform the upgrade.  This way, the upgrade
 # program will be able to upgrade both a V1.0 and a V2.0 database.

+ 3 - 3
src/bin/dbutil/tests/dbutil_test.sh.in

@@ -165,7 +165,7 @@ upgrade_ok_test() {
     if [ $? -eq 0 ]
     then
         # Compare schema with the reference
-        get_schema $testdata/v2_1.sqlite3
+        get_schema $testdata/v2_2.sqlite3
         expected_schema=$db_schema
         get_schema $tempfile
         actual_schema=$db_schema
@@ -177,7 +177,7 @@ upgrade_ok_test() {
         fi
 
         # Check the version is set correctly
-        check_version $tempfile "V2.1"
+        check_version $tempfile "V2.2"
 
         # Check that a backup was made
         check_backup $1 $2
@@ -449,7 +449,7 @@ ${SHELL} ../run_dbutil.sh --upgrade $tempfile << .
 Yes
 .
 passzero $?
-check_version $tempfile "V2.1"
+check_version $tempfile "V2.2"
 rm -f $tempfile $backupfile
 
 echo "13.4 Interactive prompt - no"

+ 1 - 0
src/bin/dbutil/tests/testdata/Makefile.am

@@ -11,3 +11,4 @@ EXTRA_DIST += README
 EXTRA_DIST += too_many_version.sqlite3
 EXTRA_DIST += v2_0.sqlite3
 EXTRA_DIST += v2_1.sqlite3
+EXTRA_DIST += v2_2.sqlite3

BIN
src/bin/dbutil/tests/testdata/v2_2.sqlite3


+ 2 - 2
src/lib/datasrc/sqlite3_accessor.cc

@@ -44,7 +44,7 @@ namespace {
 // program may not be taking advantage of features (possibly performance
 // improvements) added to the database.
 const int SQLITE_SCHEMA_MAJOR_VERSION = 2;
-const int SQLITE_SCHEMA_MINOR_VERSION = 1;
+const int SQLITE_SCHEMA_MINOR_VERSION = 2;
 }
 
 namespace isc {
@@ -338,7 +338,7 @@ public:
 const char* const SCHEMA_LIST[] = {
     "CREATE TABLE schema_version (version INTEGER NOT NULL, "
         "minor INTEGER NOT NULL DEFAULT 0)",
-    "INSERT INTO schema_version VALUES (2, 1)",
+    "INSERT INTO schema_version VALUES (2, 2)",
     "CREATE TABLE zones (id INTEGER PRIMARY KEY, "
     "name TEXT NOT NULL COLLATE NOCASE, "
     "rdclass TEXT NOT NULL COLLATE NOCASE DEFAULT 'IN', "

+ 1 - 1
src/lib/python/isc/datasrc/sqlite3_ds.py

@@ -25,7 +25,7 @@ RR_RDATA_INDEX = 7
 
 # Current major and minor versions of schema
 SCHEMA_MAJOR_VERSION = 2
-SCHEMA_MINOR_VERSION = 1
+SCHEMA_MINOR_VERSION = 2
 
 class Sqlite3DSError(Exception):
     """ Define exceptions."""