From: Tomek Mrugalski Date: Wed, 3 Dec 2014 14:29:22 +0000 (+0100) Subject: [3556] Update after review: unit-test schema simplified X-Git-Tag: kea-eng-20141219~7^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5abebed6d6643b0557c4f4ddd0fbdde21c65087a;p=thirdparty%2Fkea.git [3556] Update after review: unit-test schema simplified --- diff --git a/src/lib/dhcpsrv/tests/schema_mysql_copy.h b/src/lib/dhcpsrv/tests/schema_mysql_copy.h index 24ab8ecce9..f330867b2c 100644 --- a/src/lib/dhcpsrv/tests/schema_mysql_copy.h +++ b/src/lib/dhcpsrv/tests/schema_mysql_copy.h @@ -43,6 +43,8 @@ const char* destroy_statement[] = { // Creation of the new tables. const char* create_statement[] = { + + // Schema initialization to 1.0 starts here. "START TRANSACTION", "CREATE TABLE lease4 (" "address INT UNSIGNED PRIMARY KEY NOT NULL," @@ -94,26 +96,34 @@ const char* create_statement[] = { "INSERT INTO schema_version VALUES (1, 0)", "COMMIT", + // Schema initialization to 1.0 ends here. + + // Schema upgrade to 2.0 starts here. "ALTER TABLE lease6 " "ADD COLUMN hwaddr varbinary(20)," "ADD COLUMN hwtype smallint unsigned," "ADD COLUMN hwaddr_source int unsigned;", - "CREATE TABLE lease6_hwaddr_source (" + // Production schema has lease6_hwaddr_source table. It is not used by + // kea code and is simply useful for formulating more human readable + // queries. Hence no need to create it in tests. The actual SQL + // code remains here commented out to keep a trace that the omission + // is intentional. + + /* "CREATE TABLE lease6_hwaddr_source (" "hwaddr_source INT PRIMARY KEY NOT NULL," "name VARCHAR(40) )", - // We should probably comment those statements. They are not used by the - // tests and they slow execution down by 11 seconds on my beefy desktop. "INSERT INTO lease6_hwaddr_source VALUES (1, \"HWADDR_SOURCE_RAW\");", "INSERT INTO lease6_hwaddr_source VALUES (2, \"HWADDR_SOURCE_IPV6_LINK_LOCAL\");", "INSERT INTO lease6_hwaddr_source VALUES (4, \"HWADDR_SOURCE_DUID\");", "INSERT INTO lease6_hwaddr_source VALUES (8, \"HWADDR_SOURCE_CLIENT_ADDR_RELAY_OPTION\");", "INSERT INTO lease6_hwaddr_source VALUES (16, \"HWADDR_SOURCE_REMOTE_ID\");", "INSERT INTO lease6_hwaddr_source VALUES (32, \"HWADDR_SOURCE_SUBSCRIBER_ID\");", - "INSERT INTO lease6_hwaddr_source VALUES (64, \"HWADDR_SOURCE_DOCSIS\");", + "INSERT INTO lease6_hwaddr_source VALUES (64, \"HWADDR_SOURCE_DOCSIS\");", */ "UPDATE schema_version SET version=\"2\", minor=\"0\";", + // Schema upgrade to 2.0 ends here. NULL };