From 641beca5989a26107b911b688ed27264f9a4fa74 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 19 2019 14:06:22 +0000 Subject: Fix a number of alembic migration so they also work with mariadb Signed-off-by: Pierre-Yves Chibon --- diff --git a/alembic/versions/2b1743f77436_cascade_deleting_flags_when_tokens_are_.py b/alembic/versions/2b1743f77436_cascade_deleting_flags_when_tokens_are_.py index 1c11995..33392d8 100644 --- a/alembic/versions/2b1743f77436_cascade_deleting_flags_when_tokens_are_.py +++ b/alembic/versions/2b1743f77436_cascade_deleting_flags_when_tokens_are_.py @@ -20,7 +20,9 @@ def upgrade(): re-create it with CASCADE on delete and update. """ # alter the constraints - op.drop_constraint('pull_request_flags_token_id_fkey', 'pull_request_flags') + op.drop_constraint( + 'pull_request_flags_token_id_fkey', 'pull_request_flags', + type_='foreignkey') op.create_foreign_key( u'pull_request_flags_token_id_fkey', 'pull_request_flags', @@ -36,7 +38,9 @@ def downgrade(): """ Remove the existing foreign key in pull_request_flags.token_id and re-create it with without specifying the behavior on delete and update. """ - op.drop_constraint('pull_request_flags_token_id_fkey', 'pull_request_flags') + op.drop_constraint( + 'pull_request_flags_token_id_fkey', 'pull_request_flags', + type_='foreignkey') op.create_foreign_key( u'pull_request_flags_token_id_fkey', 'pull_request_flags', diff --git a/alembic/versions/6a3ed02ee160_new_api_token_internal_access_acl.py b/alembic/versions/6a3ed02ee160_new_api_token_internal_access_acl.py index 5cd5205..ac30732 100644 --- a/alembic/versions/6a3ed02ee160_new_api_token_internal_access_acl.py +++ b/alembic/versions/6a3ed02ee160_new_api_token_internal_access_acl.py @@ -17,8 +17,8 @@ down_revision = '9cb4580e269a' def upgrade(): """ Insert the new ACL into the database. """ op.execute( - 'INSERT INTO acls ("name", "description", "created") ' - "VALUES ('internal_access', 'Access Pagure''s internal APIs', NOW());" + 'INSERT INTO acls (name, description, created) ' + 'VALUES ("internal_access", "Access Pagure internal APIs", NOW());' ) diff --git a/alembic/versions/9cb4580e269a_add_date_updated_to_commit_flags.py b/alembic/versions/9cb4580e269a_add_date_updated_to_commit_flags.py index 36d626c..4d25f61 100644 --- a/alembic/versions/9cb4580e269a_add_date_updated_to_commit_flags.py +++ b/alembic/versions/9cb4580e269a_add_date_updated_to_commit_flags.py @@ -30,7 +30,7 @@ def upgrade(): ) op.execute('UPDATE commit_flags SET date_updated=date_created') op.alter_column( - 'commit_flags', 'date_updated', + 'commit_flags', 'date_updated', existing_type=sa.DateTime, nullable=False, existing_nullable=True) diff --git a/alembic/versions/e3cc5aedb8bb_add_date_updated_to_pr_flags.py b/alembic/versions/e3cc5aedb8bb_add_date_updated_to_pr_flags.py index 0bbfb0b..9bbadc1 100644 --- a/alembic/versions/e3cc5aedb8bb_add_date_updated_to_pr_flags.py +++ b/alembic/versions/e3cc5aedb8bb_add_date_updated_to_pr_flags.py @@ -29,7 +29,7 @@ def upgrade(): ) op.execute('UPDATE pull_request_flags SET date_updated=date_created') op.alter_column( - 'pull_request_flags', 'date_updated', + 'pull_request_flags', 'date_updated', existing_type=sa.DateTime, nullable=False, existing_nullable=True)