Parcourir la source

[github30] Updated MySQL upgrade scripts to use single quote.

Marcin Siodelski il y a 8 ans
Parent
commit
74d4720d29

+ 1 - 1
src/bin/admin/admin-utils.sh

@@ -30,7 +30,7 @@ mysql_execute() {
 }
 }
 
 
 mysql_version() {
 mysql_version() {
-    mysql_execute "SELECT CONCAT(version,\".\",minor) FROM schema_version" "$@"
+    mysql_execute "SELECT CONCAT_WS('.', version, minor) FROM schema_version" "$@"
     return $?
     return $?
 }
 }
 
 

+ 4 - 4
src/bin/admin/tests/dhcpdb_create_1.0.mysql

@@ -77,15 +77,15 @@ CREATE TABLE lease6_types (
     name VARCHAR(5)                             # Name of the lease type
     name VARCHAR(5)                             # Name of the lease type
     ) ENGINE = INNODB;
     ) ENGINE = INNODB;
 START TRANSACTION;
 START TRANSACTION;
-INSERT INTO lease6_types VALUES (0, "IA_NA");   # Non-temporary v6 addresses
-INSERT INTO lease6_types VALUES (1, "IA_TA");   # Temporary v6 addresses
-INSERT INTO lease6_types VALUES (2, "IA_PD");   # Prefix delegations
+INSERT INTO lease6_types VALUES (0, 'IA_NA');   # Non-temporary v6 addresses
+INSERT INTO lease6_types VALUES (1, 'IA_TA');   # Temporary v6 addresses
+INSERT INTO lease6_types VALUES (2, 'IA_PD');   # Prefix delegations
 COMMIT;
 COMMIT;
 
 
 # Finally, the version of the schema.  We start at 0.1 during development.
 # Finally, the version of the schema.  We start at 0.1 during development.
 # This table is only modified during schema upgrades.  For historical reasons
 # This table is only modified during schema upgrades.  For historical reasons
 # (related to the names of the columns in the BIND 10 DNS database file), the
 # (related to the names of the columns in the BIND 10 DNS database file), the
-# first column is called "version" and not "major".
+# first column is called 'version' and not 'major'.
 # Note: This MUST be kept in step with src/share/database/scripts/mysql/dhcpdb_create.mysql,
 # Note: This MUST be kept in step with src/share/database/scripts/mysql/dhcpdb_create.mysql,
 # which defines the schema for the unit tests.
 # which defines the schema for the unit tests.
 CREATE TABLE schema_version (
 CREATE TABLE schema_version (

+ 6 - 6
src/bin/admin/tests/mysql_tests.sh.in

@@ -394,9 +394,9 @@ mysql_lease4_dump_test() {
 
 
     # Insert the reference record
     # Insert the reference record
     insert_sql="\
     insert_sql="\
-insert into lease4 values(10,20,30,40,\"2015-01-01 01:15:30\",50,1,1,\"one.example.com\", 0);\
-insert into lease4 values(11,NULL,123,40,\"2015-02-02 02:30:45\",50,1,1,\"\", 1);\
-insert into lease4 values(12,22,NULL,40,\"2015-03-03 11:01:07\",50,1,1,\"three.example.com\", 2);"
+insert into lease4 values(10,20,30,40,'2015-01-01 01:15:30',50,1,1,'one.example.com', 0);\
+insert into lease4 values(11,NULL,123,40,'2015-02-02 02:30:45',50,1,1,'', 1);\
+insert into lease4 values(12,22,NULL,40,'2015-03-03 11:01:07',50,1,1,'three.example.com', 2);"
 
 
     mysql_execute "$insert_sql"
     mysql_execute "$insert_sql"
     ERRCODE=$?
     ERRCODE=$?
@@ -454,9 +454,9 @@ mysql_lease6_dump_test() {
 
 
     # Insert the reference record
     # Insert the reference record
     insert_sql="\
     insert_sql="\
-insert into lease6 values(10,20,30,\"2015-04-04 01:15:30\",40,50,1,60,70,1,1,\"one.example.com\",80,90,16,0);\
-insert into lease6 values(11,NULL,30,\"2015-05-05 02:30:45\",40,50,1,60,70,1,1,\"\",80,90,1,1);\
-insert into lease6 values(12,21,30,\"2015-06-06 11:01:07\",40,50,1,60,70,1,1,\"three.example.com\",80,90,4,2);"
+insert into lease6 values(10,20,30,'2015-04-04 01:15:30',40,50,1,60,70,1,1,'one.example.com',80,90,16,0);\
+insert into lease6 values(11,NULL,30,'2015-05-05 02:30:45',40,50,1,60,70,1,1,'',80,90,1,1);\
+insert into lease6 values(12,21,30,'2015-06-06 11:01:07',40,50,1,60,70,1,1,'three.example.com',80,90,4,2);"
 
 
     mysql_execute "$insert_sql"
     mysql_execute "$insert_sql"
     ERRCODE=$?
     ERRCODE=$?

+ 9 - 9
src/share/database/scripts/mysql/upgrade_1.0_to_2.0.sh.in

@@ -27,15 +27,15 @@ CREATE TABLE lease_hwaddr_source (
 ) ENGINE = INNODB;
 ) ENGINE = INNODB;
 
 
 -- See src/lib/dhcp/dhcp/pkt.h for detailed explanation
 -- See src/lib/dhcp/dhcp/pkt.h for detailed explanation
-INSERT INTO lease_hwaddr_source VALUES (1, "HWADDR_SOURCE_RAW");
-INSERT INTO lease_hwaddr_source VALUES (2, "HWADDR_SOURCE_IPV6_LINK_LOCAL");
-INSERT INTO lease_hwaddr_source VALUES (4, "HWADDR_SOURCE_DUID");
-INSERT INTO lease_hwaddr_source VALUES (8, "HWADDR_SOURCE_CLIENT_ADDR_RELAY_OPTION");
-INSERT INTO lease_hwaddr_source VALUES (16, "HWADDR_SOURCE_REMOTE_ID");
-INSERT INTO lease_hwaddr_source VALUES (32, "HWADDR_SOURCE_SUBSCRIBER_ID");
-INSERT INTO lease_hwaddr_source VALUES (64, "HWADDR_SOURCE_DOCSIS");
-
-UPDATE schema_version SET version="2", minor="0";
+INSERT INTO lease_hwaddr_source VALUES (1, 'HWADDR_SOURCE_RAW');
+INSERT INTO lease_hwaddr_source VALUES (2, 'HWADDR_SOURCE_IPV6_LINK_LOCAL');
+INSERT INTO lease_hwaddr_source VALUES (4, 'HWADDR_SOURCE_DUID');
+INSERT INTO lease_hwaddr_source VALUES (8, 'HWADDR_SOURCE_CLIENT_ADDR_RELAY_OPTION');
+INSERT INTO lease_hwaddr_source VALUES (16, 'HWADDR_SOURCE_REMOTE_ID');
+INSERT INTO lease_hwaddr_source VALUES (32, 'HWADDR_SOURCE_SUBSCRIBER_ID');
+INSERT INTO lease_hwaddr_source VALUES (64, 'HWADDR_SOURCE_DOCSIS');
+
+UPDATE schema_version SET version='2', minor='0';
 EOF
 EOF
 
 
 RESULT=$?
 RESULT=$?

+ 1 - 1
src/share/database/scripts/mysql/upgrade_2.0_to_3.0.sh.in

@@ -96,7 +96,7 @@ END
 $$
 $$
 DELIMITER ;
 DELIMITER ;
 
 
-UPDATE schema_version SET version="3", minor="0";
+UPDATE schema_version SET version='3', minor='0';
 EOF
 EOF
 
 
 RESULT=$?
 RESULT=$?

+ 3 - 3
src/share/database/scripts/mysql/upgrade_3.0_to_4.0.sh.in

@@ -40,9 +40,9 @@ CREATE TABLE IF NOT EXISTS lease_state (
 ) ENGINE=INNODB;
 ) ENGINE=INNODB;
 
 
 # Insert currently defined state names.
 # Insert currently defined state names.
-INSERT INTO lease_state VALUES (0, "default");
-INSERT INTO lease_state VALUES (1, "declined");
-INSERT INTO lease_state VALUES (2, "expired-reclaimed");
+INSERT INTO lease_state VALUES (0, 'default');
+INSERT INTO lease_state VALUES (1, 'declined');
+INSERT INTO lease_state VALUES (2, 'expired-reclaimed');
 
 
 # Add a constraint that any state value added to the lease4 must
 # Add a constraint that any state value added to the lease4 must
 # map to a value in the lease_state table.
 # map to a value in the lease_state table.

+ 1 - 1
src/share/database/scripts/mysql/upgrade_4.0_to_4.1.sh.in

@@ -19,7 +19,7 @@ mysql "$@" <<EOF
 
 
 # In the event hardware address cannot be determined, we need to satisfy
 # In the event hardware address cannot be determined, we need to satisfy
 # foreign key constraint between lease6 and lease_hardware_source
 # foreign key constraint between lease6 and lease_hardware_source
-INSERT INTO lease_hwaddr_source VALUES (0, "HWADDR_SOURCE_UNKNOWN");
+INSERT INTO lease_hwaddr_source VALUES (0, 'HWADDR_SOURCE_UNKNOWN');
 
 
 #
 #
 # Add order by lease address to lease4DumpData 
 # Add order by lease address to lease4DumpData 

+ 7 - 7
src/share/database/scripts/mysql/upgrade_4.1_to_5.0.sh.in

@@ -47,9 +47,9 @@ CREATE TABLE IF NOT EXISTS host_identifier_type (
 ) ENGINE = INNODB;
 ) ENGINE = INNODB;
 
 
 START TRANSACTION;
 START TRANSACTION;
-INSERT INTO host_identifier_type VALUES (0, "hw-address"); # Non-temporary v6 addresses
-INSERT INTO host_identifier_type VALUES (1, "duid");       # Temporary v6 addresses
-INSERT INTO host_identifier_type VALUES (2, "circuit-id"); # Prefix delegations
+INSERT INTO host_identifier_type VALUES (0, 'hw-address'); # Non-temporary v6 addresses
+INSERT INTO host_identifier_type VALUES (1, 'duid');       # Temporary v6 addresses
+INSERT INTO host_identifier_type VALUES (2, 'circuit-id'); # Prefix delegations
 COMMIT;
 COMMIT;
 
 
 # Add a constraint that any identifier type value added to the hosts
 # Add a constraint that any identifier type value added to the hosts
@@ -74,10 +74,10 @@ CREATE TABLE IF NOT EXISTS dhcp_option_scope (
 ) ENGINE = INNODB;
 ) ENGINE = INNODB;
 
 
 START TRANSACTION;
 START TRANSACTION;
-INSERT INTO dhcp_option_scope VALUES (0, "global");
-INSERT INTO dhcp_option_scope VALUES (1, "subnet");
-INSERT INTO dhcp_option_scope VALUES (2, "client-class");
-INSERT INTO dhcp_option_scope VALUES (3, "host");
+INSERT INTO dhcp_option_scope VALUES (0, 'global');
+INSERT INTO dhcp_option_scope VALUES (1, 'subnet');
+INSERT INTO dhcp_option_scope VALUES (2, 'client-class');
+INSERT INTO dhcp_option_scope VALUES (3, 'host');
 COMMIT;
 COMMIT;
 
 
 # Add scopes into table holding DHCPv4 options
 # Add scopes into table holding DHCPv4 options