diff --git a/designate/storage/sqlalchemy/alembic/versions/0bcf910ea823_add_zone_attributes.py b/designate/storage/sqlalchemy/alembic/versions/0bcf910ea823_add_zone_attributes.py index 4d4a3117e..1ecf94c9f 100644 --- a/designate/storage/sqlalchemy/alembic/versions/0bcf910ea823_add_zone_attributes.py +++ b/designate/storage/sqlalchemy/alembic/versions/0bcf910ea823_add_zone_attributes.py @@ -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 ' diff --git a/designate/storage/sqlalchemy/alembic/versions/304d41c3847a_add_services.py b/designate/storage/sqlalchemy/alembic/versions/304d41c3847a_add_services.py index dab9d0f59..fc752956d 100644 --- a/designate/storage/sqlalchemy/alembic/versions/304d41c3847a_add_services.py +++ b/designate/storage/sqlalchemy/alembic/versions/304d41c3847a_add_services.py @@ -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', + ) diff --git a/designate/storage/sqlalchemy/alembic/versions/b20189fd288e_shared_zone.py b/designate/storage/sqlalchemy/alembic/versions/b20189fd288e_shared_zone.py index 86a97e691..3313297c8 100644 --- a/designate/storage/sqlalchemy/alembic/versions/b20189fd288e_shared_zone.py +++ b/designate/storage/sqlalchemy/alembic/versions/b20189fd288e_shared_zone.py @@ -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', ) diff --git a/designate/storage/sqlalchemy/alembic/versions/c9f427f7180a_liberty.py b/designate/storage/sqlalchemy/alembic/versions/c9f427f7180a_liberty.py index 39724226c..fe97d8dff 100644 --- a/designate/storage/sqlalchemy/alembic/versions/c9f427f7180a_liberty.py +++ b/designate/storage/sqlalchemy/alembic/versions/c9f427f7180a_liberty.py @@ -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, @@ -145,7 +154,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, @@ -159,7 +171,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), @@ -183,7 +198,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, @@ -232,7 +250,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, @@ -245,7 +266,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, @@ -261,7 +285,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, @@ -273,7 +300,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, @@ -292,7 +322,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, @@ -311,7 +344,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, @@ -327,7 +363,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, @@ -337,4 +376,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', + ) diff --git a/designate/storage/sqlalchemy/alembic/versions/d04819112169_new_pools_tables.py b/designate/storage/sqlalchemy/alembic/versions/d04819112169_new_pools_tables.py index 7af13e41c..79c338de7 100644 --- a/designate/storage/sqlalchemy/alembic/versions/d04819112169_new_pools_tables.py +++ b/designate/storage/sqlalchemy/alembic/versions/d04819112169_new_pools_tables.py @@ -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', + ) diff --git a/releasenotes/notes/enforce-utf8-tables-mysql-274b5c3c1afe4b3b.yaml b/releasenotes/notes/enforce-utf8-tables-mysql-274b5c3c1afe4b3b.yaml new file mode 100644 index 000000000..ccd56f318 --- /dev/null +++ b/releasenotes/notes/enforce-utf8-tables-mysql-274b5c3c1afe4b3b.yaml @@ -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.