Merge "Add charset and engine parameters to alembic create tables"

This commit is contained in:
Zuul 2023-11-19 02:43:28 +00:00 committed by Gerrit Code Review
commit 3e5ad20856
6 changed files with 92 additions and 21 deletions

View File

@ -60,7 +60,10 @@ def upgrade() -> None:
sa.Column('port', sa.Integer, nullable=False),
sa.Column('zone_id', UUID, nullable=False),
sa.UniqueConstraint('host', 'port', 'zone_id', name='unique_masters'),
sa.ForeignKeyConstraint(['zone_id'], ['zones.id'], ondelete='CASCADE'))
sa.ForeignKeyConstraint(['zone_id'], ['zones.id'], ondelete='CASCADE'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
zone_attr_sql = sa.text(
'SELECT id, version, created_at, updated_at, value, zone_id FROM '

View File

@ -56,4 +56,7 @@ def upgrade() -> None:
sa.Column('status', sa.Enum(name='service_statuses_enum',
*SERVICE_STATES), nullable=False),
sa.Column('stats', sa.Text, nullable=False),
sa.Column('capabilities', sa.Text, nullable=False))
sa.Column('capabilities', sa.Text, nullable=False),
mysql_engine='InnoDB',
mysql_charset='utf8',
)

View File

@ -45,4 +45,6 @@ def upgrade() -> None:
sa.UniqueConstraint('zone_id', 'project_id', 'target_project_id',
name='unique_shared_zone'),
sa.ForeignKeyConstraint(['zone_id'], ['zones.id'], ondelete='CASCADE'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)

View File

@ -73,7 +73,10 @@ def upgrade() -> None:
sa.Column('provisioner', sa.Enum(name='pool_provisioner',
*POOL_PROVISIONERS),
nullable=False, server_default='UNMANAGED'),
sa.UniqueConstraint('name', name='unique_pool_name'))
sa.UniqueConstraint('name', name='unique_pool_name'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.bulk_insert(
pools_table,
@ -90,7 +93,10 @@ def upgrade() -> None:
sa.Column('pool_id', UUID, nullable=False),
sa.Column('priority', sa.Integer, nullable=False),
sa.Column('hostname', sa.String(255), nullable=False),
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'], ondelete='CASCADE'))
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'], ondelete='CASCADE'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'pool_attributes', metadata,
@ -103,7 +109,10 @@ def upgrade() -> None:
sa.Column('pool_id', UUID, nullable=False),
sa.UniqueConstraint('pool_id', 'key', 'value',
name='unique_pool_attribute'),
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'], ondelete='CASCADE'))
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'], ondelete='CASCADE'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'domains', metadata,
@ -146,7 +155,10 @@ def upgrade() -> None:
sa.Index('zone_deleted', 'deleted'),
sa.Index('zone_tenant_deleted', 'tenant_id', 'deleted'),
sa.Index('reverse_name_deleted', 'reverse_name', 'deleted'),
sa.Index('zone_created_at', 'created_at'))
sa.Index('zone_created_at', 'created_at'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'domain_attributes', metadata,
@ -160,7 +172,10 @@ def upgrade() -> None:
sa.UniqueConstraint('key', 'value', 'domain_id',
name='unique_attributes'),
sa.ForeignKeyConstraint(['domain_id'], ['domains.id'],
ondelete='CASCADE'))
ondelete='CASCADE'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'recordsets', metadata,
sa.Column('id', UUID, primary_key=True),
@ -184,7 +199,10 @@ def upgrade() -> None:
sa.Index('rrset_type_domainid', 'type', 'domain_id'),
sa.Index('recordset_type_name', 'type', 'name'),
sa.Index('reverse_name_dom_id', 'reverse_name', 'domain_id'),
sa.Index('recordset_created_at', 'created_at'))
sa.Index('recordset_created_at', 'created_at'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'records', metadata,
@ -233,7 +251,10 @@ def upgrade() -> None:
sa.Index('records_tenant', 'tenant_id'),
sa.Index('record_created_at', 'created_at'),
sa.Index('update_status_index', 'status', 'domain_id', 'tenant_id',
'created_at', 'serial'))
'created_at', 'serial'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'quotas', metadata,
@ -246,7 +267,10 @@ def upgrade() -> None:
sa.Column('tenant_id', sa.String(36), nullable=False),
sa.Column('resource', sa.String(32), nullable=False),
sa.Column('hard_limit', sa.Integer, nullable=False),
sa.UniqueConstraint('tenant_id', 'resource', name='unique_quota'))
sa.UniqueConstraint('tenant_id', 'resource', name='unique_quota'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'tsigkeys', metadata,
@ -262,7 +286,10 @@ def upgrade() -> None:
sa.Column('scope', sa.Enum(name='tsig_scopes', *TSIG_SCOPES),
nullable=False, server_default='POOL'),
sa.Column('resource_id', UUID, nullable=False),
sa.UniqueConstraint('name', name='unique_tsigkey_name'))
sa.UniqueConstraint('name', name='unique_tsigkey_name'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'tlds', metadata,
@ -274,7 +301,10 @@ def upgrade() -> None:
onupdate=lambda: timeutils.utcnow()),
sa.Column('name', sa.String(255), nullable=False),
sa.Column('description', sa.Unicode(160), nullable=True),
sa.UniqueConstraint('name', name='unique_tld_name'))
sa.UniqueConstraint('name', name='unique_tld_name'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'zone_transfer_requests', metadata,
@ -293,7 +323,10 @@ def upgrade() -> None:
*TASK_STATUSES),
nullable=False, server_default='ACTIVE', default='ACTIVE'),
sa.ForeignKeyConstraint(['domain_id'], ['domains.id'],
ondelete='CASCADE'))
ondelete='CASCADE'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'zone_transfer_accepts', metadata,
@ -312,7 +345,10 @@ def upgrade() -> None:
ondelete='CASCADE'),
sa.ForeignKeyConstraint(['zone_transfer_request_id'],
['zone_transfer_requests.id'],
ondelete='CASCADE'))
ondelete='CASCADE'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'zone_tasks', metadata,
@ -328,7 +364,10 @@ def upgrade() -> None:
sa.Column('status', sa.Enum(name='zone_tasks_resource_statuses',
*TASK_STATUSES),
nullable=False, server_default='ACTIVE', default='ACTIVE'),
sa.Column('location', sa.String(160), nullable=True))
sa.Column('location', sa.String(160), nullable=True),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'blacklists', metadata,
@ -338,4 +377,7 @@ def upgrade() -> None:
sa.Column('created_at', sa.DateTime),
sa.Column('pattern', sa.String(255), nullable=False),
sa.Column('description', sa.Unicode(160), nullable=True),
sa.UniqueConstraint('pattern', name='pattern'))
sa.UniqueConstraint('pattern', name='pattern'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)

View File

@ -57,7 +57,10 @@ def upgrade() -> None:
sa.Column('port', sa.Integer, nullable=False),
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'], ondelete='CASCADE'),
sa.UniqueConstraint('pool_id', 'host', 'port',
name='unique_pool_host_port'))
name='unique_pool_host_port'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'pool_targets', metadata,
@ -71,7 +74,10 @@ def upgrade() -> None:
sa.Column('type', sa.String(50), nullable=False),
sa.Column('tsigkey_id', UUID, nullable=True),
sa.Column('description', sa.Unicode(160), nullable=True),
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'], ondelete='CASCADE'))
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'], ondelete='CASCADE'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'pool_target_masters', metadata,
@ -87,7 +93,10 @@ def upgrade() -> None:
sa.ForeignKeyConstraint(['pool_target_id'], ['pool_targets.id'],
ondelete='CASCADE'),
sa.UniqueConstraint('pool_target_id', 'host', 'port',
name='unique_pool_target_host_port'))
name='unique_pool_target_host_port'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'pool_target_options', metadata,
@ -103,7 +112,10 @@ def upgrade() -> None:
sa.ForeignKeyConstraint(['pool_target_id'], ['pool_targets.id'],
ondelete='CASCADE'),
sa.UniqueConstraint('pool_target_id', 'key',
name='unique_pool_target_key'))
name='unique_pool_target_key'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)
op.create_table(
'pool_also_notifies', metadata,
@ -118,4 +130,7 @@ def upgrade() -> None:
sa.Column('port', sa.Integer, nullable=False),
sa.ForeignKeyConstraint(['pool_id'], ['pools.id'], ondelete='CASCADE'),
sa.UniqueConstraint('pool_id', 'host', 'port',
name='unique_pool_also_notifies_pool0host0port'))
name='unique_pool_also_notifies_pool0host0port'),
mysql_engine='InnoDB',
mysql_charset='utf8',
)

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Database tables are now explicitly created with charset=utf8. This resolves
an issue running ``designate-manage database sync`` when the designate
database was not created with the default charset set to utf8.