db: Remove legacy migrations

Unlike Cinder, Nova etc., we haven't had any sqlalchemy-migrate-based
migrations in Heat for some time. That means we don't need a transition
period to handle users that may not have the latest
sqlalchemy-migrate-based migration and we can remove these migrations
immediately. Doing so also means we can also remove sqlalchemy-migrate
from our dependencies. Hurrah!

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I825c58a42e9d430c9d660dae9bb70d1cb6f91079
This commit is contained in:
Stephen Finucane 2023-03-23 10:20:00 +00:00 committed by Takashi Kajinami
parent 5d3ce78d54
commit 998d8df420
21 changed files with 0 additions and 775 deletions

View File

@ -179,7 +179,6 @@ apidoc_excluded_paths = [
'cmd', 'cmd',
'cloudinit', 'cloudinit',
'db/sqlalchemy/migrations/versions', 'db/sqlalchemy/migrations/versions',
'db/sqlalchemy/migrate_repo/versions',
'engine/resources/aws', 'engine/resources/aws',
'engine/resources/openstack', 'engine/resources/openstack',
'hacking', 'hacking',

View File

@ -1,4 +0,0 @@
This is a database migration repository.
More information at
https://opendev.org/openstack/sqlalchemy-migrate

View File

@ -1,18 +0,0 @@
#!/usr/bin/env python
# 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.
from migrate.versioning.shell import main
if __name__ == '__main__':
main(debug='False')

View File

@ -1,25 +0,0 @@
[db_settings]
# Used to identify which repository this database is versioned under.
# You can use the name of your project.
repository_id=heat
# The name of the database table used to track the schema version.
# This name shouldn't already be used by your project.
# If this is changed once a database is under version control, you'll need to
# change the table name in each database too.
version_table=migrate_version
# When committing a change script, Migrate will attempt to generate the
# sql for all supported databases; normally, if one of them fails - probably
# because you don't have that database installed - it is ignored and the
# commit continues, perhaps ending successfully.
# Databases in this list MUST compile successfully during a commit, or the
# entire commit will fail. List the databases your application will actually
# be using to ensure your updates to that database work properly.
# This must be a list; example: ['postgres','sqlite']
required_dbs=[]
# When creating new change scripts, Migrate will stamp the new script with
# a version number. By default this is latest_version + 1. You can set this
# to 'true' to tell Migrate to use the UTC timestamp instead.
use_timestamp_numbering=False

View File

@ -1,387 +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
from heat.db.sqlalchemy import types
def upgrade(migrate_engine):
meta = sqlalchemy.MetaData()
meta.bind = migrate_engine
raw_template_files = sqlalchemy.Table(
'raw_template_files', meta,
sqlalchemy.Column('id', sqlalchemy.Integer,
primary_key=True,
nullable=False),
sqlalchemy.Column('files', types.Json),
sqlalchemy.Column('created_at', sqlalchemy.DateTime),
sqlalchemy.Column('updated_at', sqlalchemy.DateTime),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
raw_template = sqlalchemy.Table(
'raw_template', 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('template', types.LongText),
sqlalchemy.Column('files', types.Json),
sqlalchemy.Column('environment', types.Json),
sqlalchemy.Column('files_id', sqlalchemy.Integer(),
sqlalchemy.ForeignKey(
'raw_template_files.id',
name='raw_tmpl_files_fkey_ref')),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
user_creds = sqlalchemy.Table(
'user_creds', 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('username', sqlalchemy.String(255)),
sqlalchemy.Column('password', sqlalchemy.String(255)),
sqlalchemy.Column('region_name', sqlalchemy.String(length=255)),
sqlalchemy.Column('decrypt_method', sqlalchemy.String(length=64)),
sqlalchemy.Column('tenant', sqlalchemy.String(1024)),
sqlalchemy.Column('auth_url', sqlalchemy.Text),
sqlalchemy.Column('tenant_id', sqlalchemy.String(256)),
sqlalchemy.Column('trust_id', sqlalchemy.String(255)),
sqlalchemy.Column('trustor_user_id', sqlalchemy.String(64)),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
stack = sqlalchemy.Table(
'stack', meta,
sqlalchemy.Column('id', sqlalchemy.String(36),
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,
sqlalchemy.ForeignKey('raw_template.id'),
nullable=False),
sqlalchemy.Column('prev_raw_template_id',
sqlalchemy.Integer,
sqlalchemy.ForeignKey('raw_template.id')),
sqlalchemy.Column('user_creds_id', sqlalchemy.Integer,
sqlalchemy.ForeignKey('user_creds.id')),
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.Text),
sqlalchemy.Column('timeout', sqlalchemy.Integer),
sqlalchemy.Column('tenant', sqlalchemy.String(256)),
sqlalchemy.Column('disable_rollback', sqlalchemy.Boolean,
nullable=False),
sqlalchemy.Column('stack_user_project_id',
sqlalchemy.String(length=64)),
sqlalchemy.Column('backup', sqlalchemy.Boolean, default=False),
sqlalchemy.Column('nested_depth', sqlalchemy.Integer, default=0),
sqlalchemy.Column('convergence', sqlalchemy.Boolean, default=False),
sqlalchemy.Column('current_traversal', sqlalchemy.String(36)),
sqlalchemy.Column('current_deps', types.Json),
sqlalchemy.Column('parent_resource_name', sqlalchemy.String(255)),
sqlalchemy.Index('ix_stack_name', 'name', mysql_length=255),
sqlalchemy.Index('ix_stack_tenant', 'tenant', mysql_length=255),
sqlalchemy.Index('ix_stack_owner_id', 'owner_id', mysql_length=36),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
resource = sqlalchemy.Table(
'resource', meta,
sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True,
nullable=False),
sqlalchemy.Column('uuid', sqlalchemy.String(36), unique=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('action', sqlalchemy.String(255)),
sqlalchemy.Column('status', sqlalchemy.String(255)),
sqlalchemy.Column('status_reason', sqlalchemy.Text),
sqlalchemy.Column('stack_id', sqlalchemy.String(36),
sqlalchemy.ForeignKey('stack.id'), nullable=False),
sqlalchemy.Column('rsrc_metadata', types.LongText),
sqlalchemy.Column('properties_data', types.Json),
sqlalchemy.Column('engine_id', sqlalchemy.String(length=36)),
sqlalchemy.Column('atomic_key', sqlalchemy.Integer),
sqlalchemy.Column('needed_by', types.List),
sqlalchemy.Column('requires', types.List),
sqlalchemy.Column('replaces', sqlalchemy.Integer),
sqlalchemy.Column('replaced_by', sqlalchemy.Integer),
sqlalchemy.Column('current_template_id', sqlalchemy.Integer,
sqlalchemy.ForeignKey('raw_template.id')),
sqlalchemy.Column('properties_data_encrypted',
sqlalchemy.Boolean,
default=False),
sqlalchemy.Column('root_stack_id', sqlalchemy.String(36)),
sqlalchemy.Index('ix_resource_root_stack_id',
'root_stack_id',
mysql_length=36),
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('decrypt_method', sqlalchemy.String(length=64)),
sqlalchemy.Column('resource_id',
sqlalchemy.Integer,
sqlalchemy.ForeignKey('resource.id',
name='fk_resource_id',
ondelete='CASCADE'),
nullable=False),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
event = sqlalchemy.Table(
'event', meta,
sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True,
nullable=False),
sqlalchemy.Column('uuid', sqlalchemy.String(36),
default=lambda: str(uuid.uuid4()), unique=True),
sqlalchemy.Column('stack_id', sqlalchemy.String(36),
sqlalchemy.ForeignKey('stack.id'), nullable=False),
sqlalchemy.Column('created_at', sqlalchemy.DateTime),
sqlalchemy.Column('updated_at', sqlalchemy.DateTime),
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)),
sqlalchemy.Column('resource_properties', sqlalchemy.PickleType),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
watch_rule = sqlalchemy.Table(
'watch_rule', 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('name', sqlalchemy.String(255)),
sqlalchemy.Column('state', sqlalchemy.String(255)),
sqlalchemy.Column('rule', types.LongText),
sqlalchemy.Column('last_evaluated', sqlalchemy.DateTime),
sqlalchemy.Column('stack_id', sqlalchemy.String(36),
sqlalchemy.ForeignKey('stack.id'), nullable=False),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
watch_data = sqlalchemy.Table(
'watch_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('data', types.LongText),
sqlalchemy.Column('watch_rule_id', sqlalchemy.Integer,
sqlalchemy.ForeignKey('watch_rule.id'),
nullable=False),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
stack_lock = sqlalchemy.Table(
'stack_lock', meta,
sqlalchemy.Column('stack_id', sqlalchemy.String(length=36),
sqlalchemy.ForeignKey('stack.id'),
primary_key=True,
nullable=False),
sqlalchemy.Column('created_at', sqlalchemy.DateTime),
sqlalchemy.Column('updated_at', sqlalchemy.DateTime),
sqlalchemy.Column('engine_id', sqlalchemy.String(length=36)),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
software_config = sqlalchemy.Table(
'software_config', meta,
sqlalchemy.Column('id', sqlalchemy.String(36),
primary_key=True,
nullable=False),
sqlalchemy.Column('created_at', sqlalchemy.DateTime),
sqlalchemy.Column('updated_at', sqlalchemy.DateTime),
sqlalchemy.Column('name', sqlalchemy.String(255)),
sqlalchemy.Column('group', sqlalchemy.String(255)),
sqlalchemy.Column('config', types.LongText),
sqlalchemy.Column('tenant', sqlalchemy.String(64),
nullable=False,
index=True),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
software_deployment = sqlalchemy.Table(
'software_deployment', meta,
sqlalchemy.Column('id', sqlalchemy.String(36),
primary_key=True,
nullable=False),
sqlalchemy.Column('created_at', sqlalchemy.DateTime,
index=True),
sqlalchemy.Column('updated_at', sqlalchemy.DateTime),
sqlalchemy.Column('server_id', sqlalchemy.String(36),
nullable=False,
index=True),
sqlalchemy.Column('config_id',
sqlalchemy.String(36),
sqlalchemy.ForeignKey('software_config.id'),
nullable=False),
sqlalchemy.Column('input_values', types.Json),
sqlalchemy.Column('output_values', types.Json),
sqlalchemy.Column('action', sqlalchemy.String(255)),
sqlalchemy.Column('status', sqlalchemy.String(255)),
sqlalchemy.Column('status_reason', sqlalchemy.Text),
sqlalchemy.Column('tenant', sqlalchemy.String(64),
nullable=False,
index=True),
sqlalchemy.Column('stack_user_project_id',
sqlalchemy.String(length=64)),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
snapshot = sqlalchemy.Table(
'snapshot', meta,
sqlalchemy.Column('id', sqlalchemy.String(36),
primary_key=True,
nullable=False),
sqlalchemy.Column('stack_id',
sqlalchemy.String(36),
sqlalchemy.ForeignKey('stack.id'),
nullable=False),
sqlalchemy.Column('name', sqlalchemy.String(255)),
sqlalchemy.Column('created_at', sqlalchemy.DateTime),
sqlalchemy.Column('updated_at', sqlalchemy.DateTime),
sqlalchemy.Column('status', sqlalchemy.String(255)),
sqlalchemy.Column('status_reason', sqlalchemy.String(255)),
sqlalchemy.Column('data', types.Json),
sqlalchemy.Column('tenant', sqlalchemy.String(64),
nullable=False,
index=True),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
service = sqlalchemy.Table(
'service', meta,
sqlalchemy.Column('id', sqlalchemy.String(36), primary_key=True,
default=lambda: str(uuid.uuid4())),
sqlalchemy.Column('engine_id', sqlalchemy.String(36), nullable=False),
sqlalchemy.Column('host', sqlalchemy.String(255), nullable=False),
sqlalchemy.Column('hostname', sqlalchemy.String(255), nullable=False),
sqlalchemy.Column('binary', sqlalchemy.String(255), nullable=False),
sqlalchemy.Column('topic', sqlalchemy.String(255), nullable=False),
sqlalchemy.Column('report_interval', sqlalchemy.Integer,
nullable=False),
sqlalchemy.Column('created_at', sqlalchemy.DateTime),
sqlalchemy.Column('updated_at', sqlalchemy.DateTime),
sqlalchemy.Column('deleted_at', sqlalchemy.DateTime),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
stack_tag = sqlalchemy.Table(
'stack_tag', 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('tag', sqlalchemy.Unicode(80)),
sqlalchemy.Column('stack_id',
sqlalchemy.String(36),
sqlalchemy.ForeignKey('stack.id'),
nullable=False),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
sync_point = sqlalchemy.Table(
'sync_point', meta,
sqlalchemy.Column('entity_id', sqlalchemy.String(36)),
sqlalchemy.Column('traversal_id', sqlalchemy.String(36)),
sqlalchemy.Column('is_update', sqlalchemy.Boolean),
sqlalchemy.Column('atomic_key', sqlalchemy.Integer,
nullable=False),
sqlalchemy.Column('stack_id', sqlalchemy.String(36),
nullable=False),
sqlalchemy.Column('input_data', types.Json),
sqlalchemy.Column('created_at', sqlalchemy.DateTime),
sqlalchemy.Column('updated_at', sqlalchemy.DateTime),
sqlalchemy.PrimaryKeyConstraint('entity_id',
'traversal_id',
'is_update'),
sqlalchemy.ForeignKeyConstraint(['stack_id'], ['stack.id'],
name='fk_stack_id'),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
tables = (
raw_template_files,
raw_template,
user_creds,
stack,
resource,
resource_data,
event,
watch_rule,
watch_data,
stack_lock,
software_config,
software_deployment,
snapshot,
service,
stack_tag,
sync_point,
)
for index, table in enumerate(tables):
try:
table.create()
except Exception:
# If an error occurs, drop all tables created so far to return
# to the previously existing state.
meta.drop_all(tables=tables[:index])
raise

View File

@ -1,20 +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.
# This is a placeholder for Newton backports.
# Do not use this number for new Ocata work, which starts after
# all the placeholders.
def upgrade(migrate_engine):
pass

View File

@ -1,20 +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.
# This is a placeholder for Newton backports.
# Do not use this number for new Ocata work, which starts after
# all the placeholders.
def upgrade(migrate_engine):
pass

View File

@ -1,20 +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.
# This is a placeholder for Newton backports.
# Do not use this number for new Ocata work, which starts after
# all the placeholders.
def upgrade(migrate_engine):
pass

View File

@ -1,20 +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.
# This is a placeholder for Newton backports.
# Do not use this number for new Ocata work, which starts after
# all the placeholders.
def upgrade(migrate_engine):
pass

View File

@ -1,20 +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.
# This is a placeholder for Newton backports.
# Do not use this number for new Ocata work, which starts after
# all the placeholders.
def upgrade(migrate_engine):
pass

View File

@ -1,55 +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.
from migrate.changeset import constraint
import sqlalchemy
from heat.db.sqlalchemy import types
def upgrade(migrate_engine):
meta = sqlalchemy.MetaData(bind=migrate_engine)
resource_properties_data = sqlalchemy.Table(
'resource_properties_data', meta,
sqlalchemy.Column('id', sqlalchemy.Integer,
primary_key=True,
nullable=False),
sqlalchemy.Column('data', types.Json),
sqlalchemy.Column('encrypted', sqlalchemy.Boolean),
sqlalchemy.Column('created_at', sqlalchemy.DateTime),
sqlalchemy.Column('updated_at', sqlalchemy.DateTime),
mysql_engine='InnoDB',
mysql_charset='utf8'
)
resource_properties_data.create()
resource = sqlalchemy.Table('resource', meta, autoload=True)
rsrc_prop_data_id = sqlalchemy.Column('rsrc_prop_data_id',
sqlalchemy.Integer)
rsrc_prop_data_id.create(resource)
res_fkey = constraint.ForeignKeyConstraint(
columns=[resource.c.rsrc_prop_data_id],
refcolumns=[resource_properties_data.c.id],
name='rsrc_rsrc_prop_data_ref')
res_fkey.create()
event = sqlalchemy.Table('event', meta, autoload=True)
rsrc_prop_data_id = sqlalchemy.Column('rsrc_prop_data_id',
sqlalchemy.Integer)
rsrc_prop_data_id.create(event)
ev_fkey = constraint.ForeignKeyConstraint(
columns=[event.c.rsrc_prop_data_id],
refcolumns=[resource_properties_data.c.id],
name='ev_rsrc_prop_data_ref')
ev_fkey.create()

View File

@ -1,31 +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.
from migrate.changeset import constraint
import sqlalchemy
def upgrade(migrate_engine):
meta = sqlalchemy.MetaData(bind=migrate_engine)
resource = sqlalchemy.Table('resource', meta, autoload=True)
resource_properties_data = sqlalchemy.Table('resource_properties_data',
meta, autoload=True)
attr_data_id = sqlalchemy.Column('attr_data_id',
sqlalchemy.Integer)
attr_data_id.create(resource)
res_fkey = constraint.ForeignKeyConstraint(
columns=[resource.c.attr_data_id],
refcolumns=[resource_properties_data.c.id],
name='rsrc_attr_data_ref')
res_fkey.create()

View File

@ -1,20 +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.
# This is a placeholder for Pike backports.
# Do not use this number for new Queens work, which starts after
# all the placeholders.
def upgrade(migrate_engine):
pass

View File

@ -1,20 +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.
# This is a placeholder for Pike backports.
# Do not use this number for new Queens work, which starts after
# all the placeholders.
def upgrade(migrate_engine):
pass

View File

@ -1,20 +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.
# This is a placeholder for Pike backports.
# Do not use this number for new Queens work, which starts after
# all the placeholders.
def upgrade(migrate_engine):
pass

View File

@ -1,20 +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.
# This is a placeholder for Pike backports.
# Do not use this number for new Queens work, which starts after
# all the placeholders.
def upgrade(migrate_engine):
pass

View File

@ -1,20 +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.
# This is a placeholder for Pike backports.
# Do not use this number for new Queens work, which starts after
# all the placeholders.
def upgrade(migrate_engine):
pass

View File

@ -1,53 +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.
from migrate import ForeignKeyConstraint
from sqlalchemy.engine import reflection
from sqlalchemy import MetaData
from sqlalchemy import Table
def upgrade(engine):
meta = MetaData()
meta.bind = engine
def _get_columns(source_table, params):
columns = set()
for column in params:
columns.add(source_table.c[column])
return columns
def _remove_foreign_key_constraints(engine, meta, table_name):
inspector = reflection.Inspector.from_engine(engine)
for fk in inspector.get_foreign_keys(table_name):
source_table = Table(table_name, meta, autoload=True)
target_table = Table(fk['referred_table'], meta, autoload=True)
fkey = ForeignKeyConstraint(
columns=_get_columns(source_table, fk['constrained_columns']),
refcolumns=_get_columns(target_table, fk['referred_columns']),
name=fk['name'])
fkey.drop()
def _drop_table_and_indexes(meta, table_name):
table = Table(table_name, meta, autoload=True)
for index in table.indexes:
index.drop()
table.drop()
table_names = ('watch_data', 'watch_rule')
for table_name in table_names:
_remove_foreign_key_constraints(engine, meta, table_name)
_drop_table_and_indexes(meta, table_name)

View File

@ -63,7 +63,6 @@ requests>=2.23.0 # Apache-2.0
tenacity>=6.1.0 # Apache-2.0 tenacity>=6.1.0 # Apache-2.0
Routes>=2.3.1 # MIT Routes>=2.3.1 # MIT
SQLAlchemy>=1.4.0 # MIT SQLAlchemy>=1.4.0 # MIT
sqlalchemy-migrate>=0.13.0 # Apache-2.0
stevedore>=3.1.0 # Apache-2.0 stevedore>=3.1.0 # Apache-2.0
WebOb>=1.7.1 # MIT WebOb>=1.7.1 # MIT
yaql>=1.1.3 # Apache 2.0 License yaql>=1.1.3 # Apache 2.0 License