Event Timeline
Comment Actions
root@db1133.eqiad.wmnet[neutron]> show create table qos_dscp_marking_rules\G *************************** 1. row *************************** Table: qos_dscp_marking_rules Create Table: CREATE TABLE `qos_dscp_marking_rules` ( `id` varchar(36) NOT NULL, `qos_policy_id` varchar(36) NOT NULL, `dscp_mark` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `qos_policy_id` (`qos_policy_id`), CONSTRAINT `qos_dscp_marking_rules_ibfk_1` FOREIGN KEY (`qos_policy_id`) REFERENCES `qos_policies` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 row in set (0.00 sec)
Comment Actions
diff --git a/neutron/db/migration/__init__.py b/neutron/db/migration/__init__.py index c5b1d773b8..ed55ff5f13 100644 --- a/neutron/db/migration/__init__.py +++ b/neutron/db/migration/__init__.py @@ -203,7 +203,7 @@ def create_table_if_not_exist_psql(table_name, values): op.execute("CREATE OR REPLACE FUNCTION table_exist(TEXT) RETURNS bool as " "$$ SELECT exists(select 1 from pg_class where relname=$1);" "$$ language sql STRICT;") - op.execute("SELECT execute($$CREATE TABLE %(name)s %(columns)s $$) " + op.execute("SELECT execute($$CREATE TABLE IF NOT EXISTS %(name)s %(columns)s $$) " "WHERE NOT table_exist(%(name)r);" % {'name': table_name, 'columns': values})