From 0ff728bc3a22edd6c1e2af6a3256826435cec20d Mon Sep 17 00:00:00 2001 From: tengqm Date: Thu, 28 May 2015 02:12:22 -0400 Subject: [PATCH] Squash Havana migration scripts Havana is not supported now (https://wiki.openstack.org/wiki/Releases), and the db migration scripts take time to execute. This patch squash DB migration scripts for Havana (aka. 2013.2). Change-Id: I1f8843462bba4c5775840e68cf24c5ddba0cc2b8 Closes-Bug: 1420103 --- .../versions/016_timeout_nullable.py | 22 -------- .../versions/017_event_state_status.py | 26 --------- .../versions/018_resource_id_uuid.py | 25 --------- .../versions/019_resource_action_status.py | 27 --------- .../migrate_repo/versions/020_stack_action.py | 24 -------- .../versions/021_resource_data.py | 40 ------------- .../versions/022_stack_event_soft_delete.py | 21 ------- .../023_raw_template_mysql_longtext.py | 24 -------- .../versions/024_event_resource_name.py | 21 ------- .../versions/025_user_creds_drop_service.py | 23 -------- .../versions/026_user_creds_drop_aws.py | 23 -------- .../versions/027_user_creds_trusts.py | 29 ---------- .../{015_grizzly.py => 028_havana.py} | 56 +++++++++++++------ .../versions/028_text_mysql_longtext.py | 34 ----------- .../versions/057_resource_uuid_to_id.py | 5 -- heat/db/sqlalchemy/migration.py | 2 +- 16 files changed, 41 insertions(+), 361 deletions(-) delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/016_timeout_nullable.py delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/017_event_state_status.py delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/018_resource_id_uuid.py delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/019_resource_action_status.py delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/020_stack_action.py delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/021_resource_data.py delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/022_stack_event_soft_delete.py delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/023_raw_template_mysql_longtext.py delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/024_event_resource_name.py delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/025_user_creds_drop_service.py delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/026_user_creds_drop_aws.py delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/027_user_creds_trusts.py rename heat/db/sqlalchemy/migrate_repo/versions/{015_grizzly.py => 028_havana.py} (76%) delete mode 100644 heat/db/sqlalchemy/migrate_repo/versions/028_text_mysql_longtext.py diff --git a/heat/db/sqlalchemy/migrate_repo/versions/016_timeout_nullable.py b/heat/db/sqlalchemy/migrate_repo/versions/016_timeout_nullable.py deleted file mode 100644 index 3f136f7aa..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/016_timeout_nullable.py +++ /dev/null @@ -1,22 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy - - -def upgrade(migrate_engine): - meta = sqlalchemy.MetaData() - meta.bind = migrate_engine - - stack = sqlalchemy.Table('stack', meta, autoload=True) - stack.c.timeout.alter(nullable=True) diff --git a/heat/db/sqlalchemy/migrate_repo/versions/017_event_state_status.py b/heat/db/sqlalchemy/migrate_repo/versions/017_event_state_status.py deleted file mode 100644 index 8431acf48..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/017_event_state_status.py +++ /dev/null @@ -1,26 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy - - -def upgrade(migrate_engine): - meta = sqlalchemy.MetaData() - meta.bind = migrate_engine - - event = sqlalchemy.Table('event', meta, autoload=True) - # Currently there is a 'name' column which really holds the - # resource status, so rename it and add a separate action column - # action is e.g "CREATE" and status is e.g "IN_PROGRESS" - event.c.name.alter(name='resource_status') - sqlalchemy.Column('resource_action', sqlalchemy.String(255)).create(event) diff --git a/heat/db/sqlalchemy/migrate_repo/versions/018_resource_id_uuid.py b/heat/db/sqlalchemy/migrate_repo/versions/018_resource_id_uuid.py deleted file mode 100644 index 12b531e16..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/018_resource_id_uuid.py +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import uuid - -import sqlalchemy - - -def upgrade(migrate_engine): - meta = sqlalchemy.MetaData(bind=migrate_engine) - - resource = sqlalchemy.Table('resource', meta, autoload=True) - - resource.c.id.alter(sqlalchemy.String(36), primary_key=True, - default=lambda: str(uuid.uuid4())) diff --git a/heat/db/sqlalchemy/migrate_repo/versions/019_resource_action_status.py b/heat/db/sqlalchemy/migrate_repo/versions/019_resource_action_status.py deleted file mode 100644 index 3ad176106..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/019_resource_action_status.py +++ /dev/null @@ -1,27 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy - - -def upgrade(migrate_engine): - meta = sqlalchemy.MetaData(bind=migrate_engine) - - resource = sqlalchemy.Table('resource', meta, autoload=True) - # Align the current state/state_description with the - # action/status now used in the event table - action = sqlalchemy.Column('action', - sqlalchemy.String(length=255)) - action.create(resource) - resource.c.state.alter(name='status') - resource.c.state_description.alter(name='status_reason') diff --git a/heat/db/sqlalchemy/migrate_repo/versions/020_stack_action.py b/heat/db/sqlalchemy/migrate_repo/versions/020_stack_action.py deleted file mode 100644 index 8f9a7e633..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/020_stack_action.py +++ /dev/null @@ -1,24 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy - - -def upgrade(migrate_engine): - meta = sqlalchemy.MetaData(bind=migrate_engine) - - stack = sqlalchemy.Table('stack', meta, autoload=True) - # Align with action/status now used in the event/resource tables - action = sqlalchemy.Column('action', - sqlalchemy.String(length=255)) - action.create(stack) diff --git a/heat/db/sqlalchemy/migrate_repo/versions/021_resource_data.py b/heat/db/sqlalchemy/migrate_repo/versions/021_resource_data.py deleted file mode 100644 index 6c6b9046f..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/021_resource_data.py +++ /dev/null @@ -1,40 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy - - -def upgrade(migrate_engine): - meta = sqlalchemy.MetaData() - meta.bind = migrate_engine - - resource_data = sqlalchemy.Table( - 'resource_data', meta, - sqlalchemy.Column('id', - sqlalchemy.Integer, - primary_key=True, - nullable=False), - sqlalchemy.Column('created_at', sqlalchemy.DateTime), - sqlalchemy.Column('updated_at', sqlalchemy.DateTime), - sqlalchemy.Column('key', sqlalchemy.String(255)), - sqlalchemy.Column('value', sqlalchemy.Text), - sqlalchemy.Column('redact', sqlalchemy.Boolean), - sqlalchemy.Column('resource_id', - sqlalchemy.String(36), - sqlalchemy.ForeignKey('resource.id'), - nullable=False), - mysql_engine='InnoDB', - mysql_charset='utf8' - ) - sqlalchemy.Table('resource', meta, autoload=True) - resource_data.create() diff --git a/heat/db/sqlalchemy/migrate_repo/versions/022_stack_event_soft_delete.py b/heat/db/sqlalchemy/migrate_repo/versions/022_stack_event_soft_delete.py deleted file mode 100644 index 6cbec067a..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/022_stack_event_soft_delete.py +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy - - -def upgrade(migrate_engine): - meta = sqlalchemy.MetaData(bind=migrate_engine) - - stack = sqlalchemy.Table('stack', meta, autoload=True) - sqlalchemy.Column('deleted_at', sqlalchemy.DateTime).create(stack) diff --git a/heat/db/sqlalchemy/migrate_repo/versions/023_raw_template_mysql_longtext.py b/heat/db/sqlalchemy/migrate_repo/versions/023_raw_template_mysql_longtext.py deleted file mode 100644 index ed73262c0..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/023_raw_template_mysql_longtext.py +++ /dev/null @@ -1,24 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy -from sqlalchemy.dialects import mysql - - -def upgrade(migrate_engine): - if migrate_engine.name != 'mysql': - return - - meta = sqlalchemy.MetaData(bind=migrate_engine) - raw_template = sqlalchemy.Table('raw_template', meta, autoload=True) - raw_template.c.template.alter(type=mysql.LONGTEXT()) diff --git a/heat/db/sqlalchemy/migrate_repo/versions/024_event_resource_name.py b/heat/db/sqlalchemy/migrate_repo/versions/024_event_resource_name.py deleted file mode 100644 index 6386dfd87..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/024_event_resource_name.py +++ /dev/null @@ -1,21 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy - - -def upgrade(migrate_engine): - meta = sqlalchemy.MetaData() - meta.bind = migrate_engine - event = sqlalchemy.Table('event', meta, autoload=True) - event.c.logical_resource_id.alter(name='resource_name') diff --git a/heat/db/sqlalchemy/migrate_repo/versions/025_user_creds_drop_service.py b/heat/db/sqlalchemy/migrate_repo/versions/025_user_creds_drop_service.py deleted file mode 100644 index 01b9d56d1..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/025_user_creds_drop_service.py +++ /dev/null @@ -1,23 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy - - -def upgrade(migrate_engine): - meta = sqlalchemy.MetaData(bind=migrate_engine) - - user_creds = sqlalchemy.Table('user_creds', meta, autoload=True) - - user_creds.c.service_user.drop() - user_creds.c.service_password.drop() diff --git a/heat/db/sqlalchemy/migrate_repo/versions/026_user_creds_drop_aws.py b/heat/db/sqlalchemy/migrate_repo/versions/026_user_creds_drop_aws.py deleted file mode 100644 index 799c95098..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/026_user_creds_drop_aws.py +++ /dev/null @@ -1,23 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy - - -def upgrade(migrate_engine): - meta = sqlalchemy.MetaData(bind=migrate_engine) - - user_creds = sqlalchemy.Table('user_creds', meta, autoload=True) - - user_creds.c.aws_creds.drop() - user_creds.c.aws_auth_url.drop() diff --git a/heat/db/sqlalchemy/migrate_repo/versions/027_user_creds_trusts.py b/heat/db/sqlalchemy/migrate_repo/versions/027_user_creds_trusts.py deleted file mode 100644 index 73607f301..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/027_user_creds_trusts.py +++ /dev/null @@ -1,29 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy - - -def upgrade(migrate_engine): - meta = sqlalchemy.MetaData(bind=migrate_engine) - - user_creds = sqlalchemy.Table('user_creds', meta, autoload=True) - - # keystone IDs are 32 characters long, but the keystone DB schema - # specifies varchar(64) so align with that here, for the trust_id - # we encrypt it, so align with the 255 chars allowed for password - trustor_user_id = sqlalchemy.Column('trustor_user_id', - sqlalchemy.String(length=64)) - trust_id = sqlalchemy.Column('trust_id', sqlalchemy.String(length=255)) - trustor_user_id.create(user_creds) - trust_id.create(user_creds) diff --git a/heat/db/sqlalchemy/migrate_repo/versions/015_grizzly.py b/heat/db/sqlalchemy/migrate_repo/versions/028_havana.py similarity index 76% rename from heat/db/sqlalchemy/migrate_repo/versions/015_grizzly.py rename to heat/db/sqlalchemy/migrate_repo/versions/028_havana.py index 9de16555b..b0989021d 100644 --- a/heat/db/sqlalchemy/migrate_repo/versions/015_grizzly.py +++ b/heat/db/sqlalchemy/migrate_repo/versions/028_havana.py @@ -11,8 +11,12 @@ # License for the specific language governing permissions and limitations # under the License. +import uuid + import sqlalchemy +from heat.db.sqlalchemy import types + def upgrade(migrate_engine): meta = sqlalchemy.MetaData() @@ -24,7 +28,7 @@ def upgrade(migrate_engine): nullable=False), sqlalchemy.Column('created_at', sqlalchemy.DateTime), sqlalchemy.Column('updated_at', sqlalchemy.DateTime), - sqlalchemy.Column('template', sqlalchemy.Text), + sqlalchemy.Column('template', types.LongText), mysql_engine='InnoDB', mysql_charset='utf8' ) @@ -37,13 +41,11 @@ def upgrade(migrate_engine): sqlalchemy.Column('updated_at', sqlalchemy.DateTime), sqlalchemy.Column('username', sqlalchemy.String(255)), sqlalchemy.Column('password', sqlalchemy.String(255)), - sqlalchemy.Column('service_user', sqlalchemy.String(255)), - sqlalchemy.Column('service_password', sqlalchemy.String(255)), sqlalchemy.Column('tenant', sqlalchemy.String(1024)), sqlalchemy.Column('auth_url', sqlalchemy.Text), - sqlalchemy.Column('aws_auth_url', sqlalchemy.Text), sqlalchemy.Column('tenant_id', sqlalchemy.String(256)), - sqlalchemy.Column('aws_creds', sqlalchemy.Text), + sqlalchemy.Column('trust_id', sqlalchemy.String(255)), + sqlalchemy.Column('trustor_user_id', sqlalchemy.String(64)), mysql_engine='InnoDB', mysql_charset='utf8' ) @@ -54,6 +56,7 @@ def upgrade(migrate_engine): primary_key=True, nullable=False), sqlalchemy.Column('created_at', sqlalchemy.DateTime), sqlalchemy.Column('updated_at', sqlalchemy.DateTime), + sqlalchemy.Column('deleted_at', sqlalchemy.DateTime), sqlalchemy.Column('name', sqlalchemy.String(255)), sqlalchemy.Column('raw_template_id', sqlalchemy.Integer, @@ -64,10 +67,11 @@ def upgrade(migrate_engine): nullable=False), sqlalchemy.Column('username', sqlalchemy.String(256)), sqlalchemy.Column('owner_id', sqlalchemy.String(36)), + sqlalchemy.Column('action', sqlalchemy.String(255)), sqlalchemy.Column('status', sqlalchemy.String(255)), sqlalchemy.Column('status_reason', sqlalchemy.String(255)), - sqlalchemy.Column('parameters', sqlalchemy.Text), - sqlalchemy.Column('timeout', sqlalchemy.Integer, nullable=False), + sqlalchemy.Column('parameters', types.LongText), + sqlalchemy.Column('timeout', sqlalchemy.Integer), sqlalchemy.Column('tenant', sqlalchemy.String(256)), sqlalchemy.Column('disable_rollback', sqlalchemy.Boolean, nullable=False), @@ -77,17 +81,35 @@ def upgrade(migrate_engine): resource = sqlalchemy.Table( 'resource', meta, - sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True, - nullable=False), + sqlalchemy.Column('id', sqlalchemy.String(36), primary_key=True, + default=lambda: str(uuid.uuid4())), sqlalchemy.Column('nova_instance', sqlalchemy.String(255)), sqlalchemy.Column('name', sqlalchemy.String(255)), sqlalchemy.Column('created_at', sqlalchemy.DateTime), sqlalchemy.Column('updated_at', sqlalchemy.DateTime), - sqlalchemy.Column('state', sqlalchemy.String(255)), - sqlalchemy.Column('state_description', sqlalchemy.String(255)), + sqlalchemy.Column('action', sqlalchemy.String(255)), + sqlalchemy.Column('status', sqlalchemy.String(255)), + sqlalchemy.Column('status_reason', sqlalchemy.String(255)), sqlalchemy.Column('stack_id', sqlalchemy.String(36), sqlalchemy.ForeignKey('stack.id'), nullable=False), - sqlalchemy.Column('rsrc_metadata', sqlalchemy.Text), + sqlalchemy.Column('rsrc_metadata', types.LongText), + mysql_engine='InnoDB', + mysql_charset='utf8' + ) + + resource_data = sqlalchemy.Table( + 'resource_data', meta, + sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True, + nullable=False), + sqlalchemy.Column('created_at', sqlalchemy.DateTime), + sqlalchemy.Column('updated_at', sqlalchemy.DateTime), + sqlalchemy.Column('key', sqlalchemy.String(255)), + sqlalchemy.Column('value', sqlalchemy.Text), + sqlalchemy.Column('redact', sqlalchemy.Boolean), + sqlalchemy.Column('resource_id', + sqlalchemy.String(36), + sqlalchemy.ForeignKey('resource.id'), + nullable=False), mysql_engine='InnoDB', mysql_charset='utf8' ) @@ -100,8 +122,9 @@ def upgrade(migrate_engine): sqlalchemy.ForeignKey('stack.id'), nullable=False), sqlalchemy.Column('created_at', sqlalchemy.DateTime), sqlalchemy.Column('updated_at', sqlalchemy.DateTime), - sqlalchemy.Column('name', sqlalchemy.String(255)), - sqlalchemy.Column('logical_resource_id', sqlalchemy.String(255)), + sqlalchemy.Column('resource_action', sqlalchemy.String(255)), + sqlalchemy.Column('resource_status', sqlalchemy.String(255)), + sqlalchemy.Column('resource_name', sqlalchemy.String(255)), sqlalchemy.Column('physical_resource_id', sqlalchemy.String(255)), sqlalchemy.Column('resource_status_reason', sqlalchemy.String(255)), sqlalchemy.Column('resource_type', sqlalchemy.String(255)), @@ -118,7 +141,7 @@ def upgrade(migrate_engine): sqlalchemy.Column('updated_at', sqlalchemy.DateTime), sqlalchemy.Column('name', sqlalchemy.String(255)), sqlalchemy.Column('state', sqlalchemy.String(255)), - sqlalchemy.Column('rule', sqlalchemy.Text), + sqlalchemy.Column('rule', types.LongText), sqlalchemy.Column('last_evaluated', sqlalchemy.DateTime), sqlalchemy.Column('stack_id', sqlalchemy.String(36), sqlalchemy.ForeignKey('stack.id'), nullable=False), @@ -132,7 +155,7 @@ def upgrade(migrate_engine): nullable=False), sqlalchemy.Column('created_at', sqlalchemy.DateTime), sqlalchemy.Column('updated_at', sqlalchemy.DateTime), - sqlalchemy.Column('data', sqlalchemy.Text), + sqlalchemy.Column('data', types.LongText), sqlalchemy.Column('watch_rule_id', sqlalchemy.Integer, sqlalchemy.ForeignKey('watch_rule.id'), nullable=False), @@ -145,6 +168,7 @@ def upgrade(migrate_engine): user_creds, stack, resource, + resource_data, event, watch_rule, watch_data, diff --git a/heat/db/sqlalchemy/migrate_repo/versions/028_text_mysql_longtext.py b/heat/db/sqlalchemy/migrate_repo/versions/028_text_mysql_longtext.py deleted file mode 100644 index 20fb6dce1..000000000 --- a/heat/db/sqlalchemy/migrate_repo/versions/028_text_mysql_longtext.py +++ /dev/null @@ -1,34 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy -from sqlalchemy.dialects import mysql - - -def upgrade(migrate_engine): - if migrate_engine.name != 'mysql': - return - - meta = sqlalchemy.MetaData(bind=migrate_engine) - - stack = sqlalchemy.Table('stack', meta, autoload=True) - stack.c.parameters.alter(type=mysql.LONGTEXT()) - - resource = sqlalchemy.Table('resource', meta, autoload=True) - resource.c.rsrc_metadata.alter(type=mysql.LONGTEXT()) - - watch_rule = sqlalchemy.Table('watch_rule', meta, autoload=True) - watch_rule.c.rule.alter(type=mysql.LONGTEXT()) - - watch_data = sqlalchemy.Table('watch_data', meta, autoload=True) - watch_data.c.data.alter(type=mysql.LONGTEXT()) diff --git a/heat/db/sqlalchemy/migrate_repo/versions/057_resource_uuid_to_id.py b/heat/db/sqlalchemy/migrate_repo/versions/057_resource_uuid_to_id.py index 0cef59da8..f064f9901 100644 --- a/heat/db/sqlalchemy/migrate_repo/versions/057_resource_uuid_to_id.py +++ b/heat/db/sqlalchemy/migrate_repo/versions/057_resource_uuid_to_id.py @@ -145,11 +145,6 @@ def upgrade_resource(migrate_engine): constraint_kwargs['name'] = 'uniq_resource0uuid0' cons = constraint.UniqueConstraint('uuid', **constraint_kwargs) cons.create() - if migrate_engine.name == 'postgresql': - # resource_id_seq will be dropped in the case of removing `id` column - # set owner to none for saving this sequence (it is needed in the - # earlier migration) - migrate_engine.execute('alter sequence resource_id_seq owned by none') res_table.c.id.drop() diff --git a/heat/db/sqlalchemy/migration.py b/heat/db/sqlalchemy/migration.py index 74680886e..0179f3d0b 100644 --- a/heat/db/sqlalchemy/migration.py +++ b/heat/db/sqlalchemy/migration.py @@ -16,7 +16,7 @@ import os from oslo_db.sqlalchemy import migration as oslo_migration -INIT_VERSION = 14 +INIT_VERSION = 27 def db_sync(engine, version=None):