"ALTER TABLE schema_version " +
"ADD COLUMN minor INTEGER NOT NULL DEFAULT 0"
]
+ },
+
+ {'from': (2, 0), 'to': (2, 1),
+ 'statements': [
+ # Enforce that only one NSEC3 RR exists for an owner name in
+ # the zone.
+ "CREATE UNIQUE INDEX nsec3_by_zoneid_and_owner ON nsec3 " +
+ "(zone_id, owner)"
+ ]
}
# To extend this, leave the above statements in place and add another
-# dictionary to the list. The "from" version should be (2, 0), the "to"
+# dictionary to the list. The "from" version should be (2, 1), 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.
if [ $? -eq 0 ]
then
# Compare schema with the reference
- get_schema $testdata/v2_0.sqlite3
+ get_schema $testdata/v2_1.sqlite3
expected_schema=$db_schema
get_schema $tempfile
actual_schema=$db_schema
fi
# Check the version is set correctly
- check_version $tempfile "V2.0"
+ check_version $tempfile "V2.1"
# Check that a backup was made
check_backup $1 $2
Yes
.
passzero $?
-check_version $tempfile "V2.0"
+check_version $tempfile "V2.1"
rm -f $tempfile $backupfile
echo "13.4 Interactive prompt - no"
EXTRA_DIST += README
EXTRA_DIST += too_many_version.sqlite3
EXTRA_DIST += v2_0.sqlite3
+EXTRA_DIST += v2_1.sqlite3
// 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 = 0;
+const int SQLITE_SCHEMA_MINOR_VERSION = 1;
}
namespace isc {
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, 0)",
+ "INSERT INTO schema_version VALUES (2, 1)",
"CREATE TABLE zones (id INTEGER PRIMARY KEY, "
"name TEXT NOT NULL COLLATE NOCASE, "
"rdclass TEXT NOT NULL COLLATE NOCASE DEFAULT 'IN', "
"ttl INTEGER NOT NULL, rdtype TEXT NOT NULL COLLATE NOCASE, "
"rdata TEXT NOT NULL)",
"CREATE INDEX nsec3_byhash ON nsec3 (hash)",
+ // Enforce that only one NSEC3 RR exists for an owner name in the zone.
+ "CREATE UNIQUE INDEX nsec3_by_zoneid_and_owner ON nsec3 (zone_id, owner)",
"CREATE TABLE diffs (id INTEGER PRIMARY KEY, "
"zone_id INTEGER NOT NULL, "
"version INTEGER NOT NULL, "
# Current major and minor versions of schema
SCHEMA_MAJOR_VERSION = 2
-SCHEMA_MINOR_VERSION = 0
+SCHEMA_MINOR_VERSION = 1
class Sqlite3DSError(Exception):
""" Define exceptions."""
rdtype TEXT NOT NULL COLLATE NOCASE,
rdata TEXT NOT NULL)""")
cur.execute("CREATE INDEX nsec3_byhash ON nsec3 (hash)")
+ # Enforce that only one NSEC3 RR exists for an owner name in the zone.
+ cur.execute("""CREATE UNIQUE INDEX nsec3_by_zoneid_and_owner ON nsec3
+ (zone_id, owner)""");
cur.execute("""CREATE TABLE diffs (id INTEGER PRIMARY KEY,
zone_id INTEGER NOT NULL,
version INTEGER NOT NULL,