From 30b0101584f8dd51660947c7c1f266ff881f5a7e Mon Sep 17 00:00:00 2001 From: Silas Sewell Date: Mon, 16 Nov 2015 13:45:00 -0500 Subject: [PATCH] Fix seq generators for enum tables in postgres This attempts to insert a temporary entry into each enum table until it succeeds. It re-synchronizes the postgres sequence generators with the max id of the table. Fixes #883 and #880 --- .../10b999e8db1f_fix_sequences_in_postgres.py | 53 +++++++++ ...a_add_metadata_field_to_external_logins.py | 2 +- ...decf6b9c4_add_revert_tag_log_entry_kind.py | 4 +- .../1f116e06b68_add_gitlab_trigger_type.py | 2 +- ...4abf14783d_add_log_entry_kind_for_verbs.py | 2 +- ...2bf8af5bad95_add_keystone_login_service.py | 2 +- ...799c8b_add_bitbucket_build_trigger_type.py | 2 +- ...c79d9_prepare_the_database_for_the_new_.py | 30 ++--- ...add_custom_git_trigger_type_to_database.py | 2 +- .../3a3bb77e17d5_add_support_for_dex_login.py | 2 +- ...a4461dc_add_support_for_squashed_images.py | 2 +- ...e2d38b52a75_add_access_token_kinds_type.py | 4 +- ...ae_add_jwt_authentication_login_service.py | 2 +- ...9f_add_log_kind_for_regenerating_robot_.py | 2 +- ...4a0c94399f38_add_new_notification_kinds.py | 6 +- ...2_add_the_maintenance_notification_type.py | 2 +- ...0e7e6f_email_invites_for_joining_a_team.py | 10 +- .../5a07499ce53f_set_up_initial_database.py | 106 +++++++++--------- .../5ad999136045_add_signature_storage.py | 4 +- ...dc2d819c5_add_vulnerability_found_event.py | 6 +- .../82297d834ad_add_us_west_location.py | 2 +- ..._add_placements_and_locations_to_the_db.py | 14 +-- 22 files changed, 157 insertions(+), 104 deletions(-) create mode 100644 data/migrations/versions/10b999e8db1f_fix_sequences_in_postgres.py diff --git a/data/migrations/versions/10b999e8db1f_fix_sequences_in_postgres.py b/data/migrations/versions/10b999e8db1f_fix_sequences_in_postgres.py new file mode 100644 index 000000000..d1500986c --- /dev/null +++ b/data/migrations/versions/10b999e8db1f_fix_sequences_in_postgres.py @@ -0,0 +1,53 @@ +"""Fix sequences in postgres + +Revision ID: 10b999e8db1f +Revises: 22af01f81722 +Create Date: 2015-11-16 14:00:05.383227 + +""" + +# revision identifiers, used by Alembic. +revision = '10b999e8db1f' +down_revision = '22af01f81722' + +from alembic import op +import sqlalchemy as sa + +import uuid +from peewee import CharField, IntegrityError + + +def upgrade(tables): + from data.database import BaseModel + + class_names = [ + 'TeamRole', + 'LoginService', + 'Visibility', + 'Role', + 'AccessTokenKind', + 'BuildTriggerService', + 'ImageStorageTransformation', + 'ImageStorageSignatureKind', + 'ImageStorageLocation', + 'LogEntryKind', + 'NotificationKind', + 'ExternalNotificationEvent', + 'ExternalNotificationMethod', + ] + + unique_name = '%s' % uuid.uuid4() + + for class_name in class_names: + Model = type(class_name, (BaseModel,), {'name': CharField(index=True)}) + + for _ in xrange(50): + try: + Model.create(name=unique_name).delete_instance() + break + except IntegrityError: + pass + + +def downgrade(tables): + pass diff --git a/data/migrations/versions/1594a74a74ca_add_metadata_field_to_external_logins.py b/data/migrations/versions/1594a74a74ca_add_metadata_field_to_external_logins.py index e4276effe..324e38c36 100644 --- a/data/migrations/versions/1594a74a74ca_add_metadata_field_to_external_logins.py +++ b/data/migrations/versions/1594a74a74ca_add_metadata_field_to_external_logins.py @@ -20,7 +20,7 @@ def upgrade(tables): op.bulk_insert(tables.loginservice, [ - {'id':4, 'name':'google'}, + {'name':'google'}, ]) def downgrade(tables): diff --git a/data/migrations/versions/1c3decf6b9c4_add_revert_tag_log_entry_kind.py b/data/migrations/versions/1c3decf6b9c4_add_revert_tag_log_entry_kind.py index 6e2bccb68..8965dfd06 100644 --- a/data/migrations/versions/1c3decf6b9c4_add_revert_tag_log_entry_kind.py +++ b/data/migrations/versions/1c3decf6b9c4_add_revert_tag_log_entry_kind.py @@ -17,7 +17,7 @@ import sqlalchemy as sa def upgrade(tables): op.bulk_insert(tables.logentrykind, [ - {'id': 47, 'name':'revert_tag'}, + {'name':'revert_tag'}, ]) @@ -26,4 +26,4 @@ def downgrade(tables): (tables.logentrykind.delete() .where(tables.logentrykind.c.name == op.inline_literal('revert_tag'))) - ) \ No newline at end of file + ) diff --git a/data/migrations/versions/1f116e06b68_add_gitlab_trigger_type.py b/data/migrations/versions/1f116e06b68_add_gitlab_trigger_type.py index 40d9a9399..ecee9ab16 100644 --- a/data/migrations/versions/1f116e06b68_add_gitlab_trigger_type.py +++ b/data/migrations/versions/1f116e06b68_add_gitlab_trigger_type.py @@ -15,7 +15,7 @@ import sqlalchemy as sa def upgrade(tables): - op.bulk_insert(tables.buildtriggerservice, [{'id': 4, 'name': 'gitlab'}]) + op.bulk_insert(tables.buildtriggerservice, [{'name': 'gitlab'}]) def downgrade(tables): diff --git a/data/migrations/versions/204abf14783d_add_log_entry_kind_for_verbs.py b/data/migrations/versions/204abf14783d_add_log_entry_kind_for_verbs.py index 981c46087..8e9176db8 100644 --- a/data/migrations/versions/204abf14783d_add_log_entry_kind_for_verbs.py +++ b/data/migrations/versions/204abf14783d_add_log_entry_kind_for_verbs.py @@ -16,7 +16,7 @@ import sqlalchemy as sa def upgrade(tables): op.bulk_insert(tables.logentrykind, [ - {'id': 46, 'name':'repo_verb'}, + {'name':'repo_verb'}, ]) diff --git a/data/migrations/versions/2bf8af5bad95_add_keystone_login_service.py b/data/migrations/versions/2bf8af5bad95_add_keystone_login_service.py index 440e7ec98..6e0cf9658 100644 --- a/data/migrations/versions/2bf8af5bad95_add_keystone_login_service.py +++ b/data/migrations/versions/2bf8af5bad95_add_keystone_login_service.py @@ -15,7 +15,7 @@ import sqlalchemy as sa def upgrade(tables): - op.bulk_insert(tables.loginservice, [{'id': 6, 'name': 'keystone'}]) + op.bulk_insert(tables.loginservice, [{'name': 'keystone'}]) def downgrade(tables): diff --git a/data/migrations/versions/313179799c8b_add_bitbucket_build_trigger_type.py b/data/migrations/versions/313179799c8b_add_bitbucket_build_trigger_type.py index 7f4d67cad..bce3a679c 100644 --- a/data/migrations/versions/313179799c8b_add_bitbucket_build_trigger_type.py +++ b/data/migrations/versions/313179799c8b_add_bitbucket_build_trigger_type.py @@ -15,7 +15,7 @@ import sqlalchemy as sa def upgrade(tables): - op.bulk_insert(tables.buildtriggerservice, [{'id': 3, 'name': 'bitbucket'}]) + op.bulk_insert(tables.buildtriggerservice, [{'name': 'bitbucket'}]) def downgrade(tables): diff --git a/data/migrations/versions/325a4d7c79d9_prepare_the_database_for_the_new_.py b/data/migrations/versions/325a4d7c79d9_prepare_the_database_for_the_new_.py index c11199a67..970a01df5 100644 --- a/data/migrations/versions/325a4d7c79d9_prepare_the_database_for_the_new_.py +++ b/data/migrations/versions/325a4d7c79d9_prepare_the_database_for_the_new_.py @@ -23,9 +23,9 @@ def upgrade(tables): op.create_index('externalnotificationmethod_name', 'externalnotificationmethod', ['name'], unique=True) op.bulk_insert(tables.externalnotificationmethod, [ - {'id':1, 'name':'quay_notification'}, - {'id':2, 'name':'email'}, - {'id':3, 'name':'webhook'}, + {'name':'quay_notification'}, + {'name':'email'}, + {'name':'webhook'}, ]) op.create_table('externalnotificationevent', sa.Column('id', sa.Integer(), nullable=False), @@ -35,11 +35,11 @@ def upgrade(tables): op.create_index('externalnotificationevent_name', 'externalnotificationevent', ['name'], unique=True) op.bulk_insert(tables.externalnotificationevent, [ - {'id':1, 'name':'repo_push'}, - {'id':2, 'name':'build_queued'}, - {'id':3, 'name':'build_start'}, - {'id':4, 'name':'build_success'}, - {'id':5, 'name':'build_failure'}, + {'name':'repo_push'}, + {'name':'build_queued'}, + {'name':'build_start'}, + {'name':'build_success'}, + {'name':'build_failure'}, ]) op.create_table('repositoryauthorizedemail', sa.Column('id', sa.Integer(), nullable=False), @@ -74,18 +74,18 @@ def upgrade(tables): # Manually add the new notificationkind types op.bulk_insert(tables.notificationkind, [ - {'id':5, 'name':'repo_push'}, - {'id':6, 'name':'build_queued'}, - {'id':7, 'name':'build_start'}, - {'id':8, 'name':'build_success'}, - {'id':9, 'name':'build_failure'}, + {'name':'repo_push'}, + {'name':'build_queued'}, + {'name':'build_start'}, + {'name':'build_success'}, + {'name':'build_failure'}, ]) # Manually add the new logentrykind types op.bulk_insert(tables.logentrykind, [ - {'id':39, 'name':'add_repo_notification'}, - {'id':40, 'name':'delete_repo_notification'}, + {'name':'add_repo_notification'}, + {'name':'delete_repo_notification'}, ]) diff --git a/data/migrations/versions/37c47a7af956_add_custom_git_trigger_type_to_database.py b/data/migrations/versions/37c47a7af956_add_custom_git_trigger_type_to_database.py index ef2f9efa3..ce92fcb0e 100644 --- a/data/migrations/versions/37c47a7af956_add_custom_git_trigger_type_to_database.py +++ b/data/migrations/versions/37c47a7af956_add_custom_git_trigger_type_to_database.py @@ -15,7 +15,7 @@ import sqlalchemy as sa def upgrade(tables): - op.bulk_insert(tables.buildtriggerservice, [{'id': 2, 'name': 'custom-git'}]) + op.bulk_insert(tables.buildtriggerservice, [{'name': 'custom-git'}]) def downgrade(tables): diff --git a/data/migrations/versions/3a3bb77e17d5_add_support_for_dex_login.py b/data/migrations/versions/3a3bb77e17d5_add_support_for_dex_login.py index 5e883237e..537285b3d 100644 --- a/data/migrations/versions/3a3bb77e17d5_add_support_for_dex_login.py +++ b/data/migrations/versions/3a3bb77e17d5_add_support_for_dex_login.py @@ -15,7 +15,7 @@ import sqlalchemy as sa def upgrade(tables): - op.bulk_insert(tables.loginservice, [{'id': 7, 'name': 'dex'}]) + op.bulk_insert(tables.loginservice, [{'name': 'dex'}]) def downgrade(tables): diff --git a/data/migrations/versions/3b4d3a4461dc_add_support_for_squashed_images.py b/data/migrations/versions/3b4d3a4461dc_add_support_for_squashed_images.py index 87d668fa3..4ac52b3a1 100644 --- a/data/migrations/versions/3b4d3a4461dc_add_support_for_squashed_images.py +++ b/data/migrations/versions/3b4d3a4461dc_add_support_for_squashed_images.py @@ -23,7 +23,7 @@ def upgrade(tables): op.create_index('imagestoragetransformation_name', 'imagestoragetransformation', ['name'], unique=True) op.bulk_insert(tables.imagestoragetransformation, [ - {'id':1, 'name':'squash'}, + {'name':'squash'}, ]) op.create_table('derivedimagestorage', sa.Column('id', sa.Integer(), nullable=False), diff --git a/data/migrations/versions/3e2d38b52a75_add_access_token_kinds_type.py b/data/migrations/versions/3e2d38b52a75_add_access_token_kinds_type.py index 53d0ae9df..f74673f53 100644 --- a/data/migrations/versions/3e2d38b52a75_add_access_token_kinds_type.py +++ b/data/migrations/versions/3e2d38b52a75_add_access_token_kinds_type.py @@ -29,8 +29,8 @@ def upgrade(tables): op.bulk_insert(tables.accesstokenkind, [ - {'id': 1, 'name':'build-worker'}, - {'id': 2, 'name':'pushpull-token'}, + {'name':'build-worker'}, + {'name':'pushpull-token'}, ]) diff --git a/data/migrations/versions/41f4587c84ae_add_jwt_authentication_login_service.py b/data/migrations/versions/41f4587c84ae_add_jwt_authentication_login_service.py index f15875b83..a0819fa58 100644 --- a/data/migrations/versions/41f4587c84ae_add_jwt_authentication_login_service.py +++ b/data/migrations/versions/41f4587c84ae_add_jwt_authentication_login_service.py @@ -17,7 +17,7 @@ import sqlalchemy as sa def upgrade(tables): op.bulk_insert(tables.loginservice, [ - {'id': 5, 'name':'jwtauthn'}, + {'name':'jwtauthn'}, ]) diff --git a/data/migrations/versions/43e943c0639f_add_log_kind_for_regenerating_robot_.py b/data/migrations/versions/43e943c0639f_add_log_kind_for_regenerating_robot_.py index 983528b06..d7ea6cb20 100644 --- a/data/migrations/versions/43e943c0639f_add_log_kind_for_regenerating_robot_.py +++ b/data/migrations/versions/43e943c0639f_add_log_kind_for_regenerating_robot_.py @@ -16,7 +16,7 @@ import sqlalchemy as sa def upgrade(tables): op.bulk_insert(tables.logentrykind, [ - {'id': 41, 'name':'regenerate_robot_token'}, + {'name':'regenerate_robot_token'}, ]) diff --git a/data/migrations/versions/4a0c94399f38_add_new_notification_kinds.py b/data/migrations/versions/4a0c94399f38_add_new_notification_kinds.py index efd3d1c60..833a4fe90 100644 --- a/data/migrations/versions/4a0c94399f38_add_new_notification_kinds.py +++ b/data/migrations/versions/4a0c94399f38_add_new_notification_kinds.py @@ -16,9 +16,9 @@ import sqlalchemy as sa def upgrade(tables): op.bulk_insert(tables.externalnotificationmethod, [ - {'id':4, 'name':'flowdock'}, - {'id':5, 'name':'hipchat'}, - {'id':6, 'name':'slack'}, + {'name':'flowdock'}, + {'name':'hipchat'}, + {'name':'slack'}, ]) def downgrade(tables): diff --git a/data/migrations/versions/4b7ef0c7bdb2_add_the_maintenance_notification_type.py b/data/migrations/versions/4b7ef0c7bdb2_add_the_maintenance_notification_type.py index 9f48ca6c6..9e8e854ff 100644 --- a/data/migrations/versions/4b7ef0c7bdb2_add_the_maintenance_notification_type.py +++ b/data/migrations/versions/4b7ef0c7bdb2_add_the_maintenance_notification_type.py @@ -16,7 +16,7 @@ import sqlalchemy as sa def upgrade(tables): op.bulk_insert(tables.notificationkind, [ - {'id':4, 'name':'maintenance'}, + {'name':'maintenance'}, ]) diff --git a/data/migrations/versions/51d04d0e7e6f_email_invites_for_joining_a_team.py b/data/migrations/versions/51d04d0e7e6f_email_invites_for_joining_a_team.py index c18335adb..d3062793b 100644 --- a/data/migrations/versions/51d04d0e7e6f_email_invites_for_joining_a_team.py +++ b/data/migrations/versions/51d04d0e7e6f_email_invites_for_joining_a_team.py @@ -36,15 +36,15 @@ def upgrade(tables): # Manually add the new logentrykind types op.bulk_insert(tables.logentrykind, [ - {'id':42, 'name':'org_invite_team_member'}, - {'id':43, 'name':'org_team_member_invite_accepted'}, - {'id':44, 'name':'org_team_member_invite_declined'}, - {'id':45, 'name':'org_delete_team_member_invite'}, + {'name':'org_invite_team_member'}, + {'name':'org_team_member_invite_accepted'}, + {'name':'org_team_member_invite_declined'}, + {'name':'org_delete_team_member_invite'}, ]) op.bulk_insert(tables.notificationkind, [ - {'id':10, 'name':'org_team_invite'}, + {'name':'org_team_invite'}, ]) def downgrade(tables): diff --git a/data/migrations/versions/5a07499ce53f_set_up_initial_database.py b/data/migrations/versions/5a07499ce53f_set_up_initial_database.py index c1d082066..db9bb69e9 100644 --- a/data/migrations/versions/5a07499ce53f_set_up_initial_database.py +++ b/data/migrations/versions/5a07499ce53f_set_up_initial_database.py @@ -24,9 +24,9 @@ def upgrade(tables): op.bulk_insert(tables.loginservice, [ - {'id':1, 'name':'github'}, - {'id':2, 'name':'quayrobot'}, - {'id':3, 'name':'ldap'}, + {'name':'github'}, + {'name':'quayrobot'}, + {'name':'ldap'}, ]) op.create_table('imagestorage', @@ -63,9 +63,9 @@ def upgrade(tables): op.bulk_insert(tables.role, [ - {'id':1, 'name':'admin'}, - {'id':2, 'name':'write'}, - {'id':3, 'name':'read'}, + {'name':'admin'}, + {'name':'write'}, + {'name':'read'}, ]) op.create_table('logentrykind', @@ -77,51 +77,51 @@ def upgrade(tables): op.bulk_insert(tables.logentrykind, [ - {'id':1, 'name':'account_change_plan'}, - {'id':2, 'name':'account_change_cc'}, - {'id':3, 'name':'account_change_password'}, - {'id':4, 'name':'account_convert'}, + {'name':'account_change_plan'}, + {'name':'account_change_cc'}, + {'name':'account_change_password'}, + {'name':'account_convert'}, - {'id':5, 'name':'create_robot'}, - {'id':6, 'name':'delete_robot'}, + {'name':'create_robot'}, + {'name':'delete_robot'}, - {'id':7, 'name':'create_repo'}, - {'id':8, 'name':'push_repo'}, - {'id':9, 'name':'pull_repo'}, - {'id':10, 'name':'delete_repo'}, - {'id':11, 'name':'create_tag'}, - {'id':12, 'name':'move_tag'}, - {'id':13, 'name':'delete_tag'}, - {'id':14, 'name':'add_repo_permission'}, - {'id':15, 'name':'change_repo_permission'}, - {'id':16, 'name':'delete_repo_permission'}, - {'id':17, 'name':'change_repo_visibility'}, - {'id':18, 'name':'add_repo_accesstoken'}, - {'id':19, 'name':'delete_repo_accesstoken'}, - {'id':20, 'name':'add_repo_webhook'}, - {'id':21, 'name':'delete_repo_webhook'}, - {'id':22, 'name':'set_repo_description'}, + {'name':'create_repo'}, + {'name':'push_repo'}, + {'name':'pull_repo'}, + {'name':'delete_repo'}, + {'name':'create_tag'}, + {'name':'move_tag'}, + {'name':'delete_tag'}, + {'name':'add_repo_permission'}, + {'name':'change_repo_permission'}, + {'name':'delete_repo_permission'}, + {'name':'change_repo_visibility'}, + {'name':'add_repo_accesstoken'}, + {'name':'delete_repo_accesstoken'}, + {'name':'add_repo_webhook'}, + {'name':'delete_repo_webhook'}, + {'name':'set_repo_description'}, - {'id':23, 'name':'build_dockerfile'}, + {'name':'build_dockerfile'}, - {'id':24, 'name':'org_create_team'}, - {'id':25, 'name':'org_delete_team'}, - {'id':26, 'name':'org_add_team_member'}, - {'id':27, 'name':'org_remove_team_member'}, - {'id':28, 'name':'org_set_team_description'}, - {'id':29, 'name':'org_set_team_role'}, + {'name':'org_create_team'}, + {'name':'org_delete_team'}, + {'name':'org_add_team_member'}, + {'name':'org_remove_team_member'}, + {'name':'org_set_team_description'}, + {'name':'org_set_team_role'}, - {'id':30, 'name':'create_prototype_permission'}, - {'id':31, 'name':'modify_prototype_permission'}, - {'id':32, 'name':'delete_prototype_permission'}, + {'name':'create_prototype_permission'}, + {'name':'modify_prototype_permission'}, + {'name':'delete_prototype_permission'}, - {'id':33, 'name':'setup_repo_trigger'}, - {'id':34, 'name':'delete_repo_trigger'}, + {'name':'setup_repo_trigger'}, + {'name':'delete_repo_trigger'}, - {'id':35, 'name':'create_application'}, - {'id':36, 'name':'update_application'}, - {'id':37, 'name':'delete_application'}, - {'id':38, 'name':'reset_application_client_secret'}, + {'name':'create_application'}, + {'name':'update_application'}, + {'name':'delete_application'}, + {'name':'reset_application_client_secret'}, ]) op.create_table('notificationkind', @@ -133,9 +133,9 @@ def upgrade(tables): op.bulk_insert(tables.notificationkind, [ - {'id':1, 'name':'password_required'}, - {'id':2, 'name':'over_private_usage'}, - {'id':3, 'name':'expiring_license'}, + {'name':'password_required'}, + {'name':'over_private_usage'}, + {'name':'expiring_license'}, ]) op.create_table('teamrole', @@ -147,9 +147,9 @@ def upgrade(tables): op.bulk_insert(tables.teamrole, [ - {'id':1, 'name':'admin'}, - {'id':2, 'name':'creator'}, - {'id':3, 'name':'member'}, + {'name':'admin'}, + {'name':'creator'}, + {'name':'member'}, ]) op.create_table('visibility', @@ -161,8 +161,8 @@ def upgrade(tables): op.bulk_insert(tables.visibility, [ - {'id':1, 'name':'public'}, - {'id':2, 'name':'private'}, + {'name':'public'}, + {'name':'private'}, ]) op.create_table('user', @@ -191,7 +191,7 @@ def upgrade(tables): op.bulk_insert(tables.buildtriggerservice, [ - {'id':1, 'name':'github'}, + {'name':'github'}, ]) op.create_table('federatedlogin', diff --git a/data/migrations/versions/5ad999136045_add_signature_storage.py b/data/migrations/versions/5ad999136045_add_signature_storage.py index 210b91175..5369b3ec5 100644 --- a/data/migrations/versions/5ad999136045_add_signature_storage.py +++ b/data/migrations/versions/5ad999136045_add_signature_storage.py @@ -38,12 +38,12 @@ def upgrade(tables): op.bulk_insert(tables.imagestoragetransformation, [ - {'id': 2, 'name':'aci'}, + {'name':'aci'}, ]) op.bulk_insert(tables.imagestoragesignaturekind, [ - {'id': 1, 'name':'gpg2'}, + {'name':'gpg2'}, ]) diff --git a/data/migrations/versions/5cdc2d819c5_add_vulnerability_found_event.py b/data/migrations/versions/5cdc2d819c5_add_vulnerability_found_event.py index 76051323a..f9440acfb 100644 --- a/data/migrations/versions/5cdc2d819c5_add_vulnerability_found_event.py +++ b/data/migrations/versions/5cdc2d819c5_add_vulnerability_found_event.py @@ -18,12 +18,12 @@ import sqlalchemy as sa def upgrade(tables): op.bulk_insert(tables.externalnotificationevent, [ - {'id':6, 'name':'vulnerability_found'}, + {'name':'vulnerability_found'}, ]) op.bulk_insert(tables.notificationkind, [ - {'id':11, 'name':'vulnerability_found'}, + {'name':'vulnerability_found'}, ]) @@ -38,4 +38,4 @@ def downgrade(tables): (tables.notificationkind.delete() .where(tables.notificationkind.c.name == op.inline_literal('vulnerability_found'))) - ) \ No newline at end of file + ) diff --git a/data/migrations/versions/82297d834ad_add_us_west_location.py b/data/migrations/versions/82297d834ad_add_us_west_location.py index 33a543062..c564557a8 100644 --- a/data/migrations/versions/82297d834ad_add_us_west_location.py +++ b/data/migrations/versions/82297d834ad_add_us_west_location.py @@ -16,7 +16,7 @@ import sqlalchemy as sa def upgrade(tables): op.bulk_insert(tables.imagestoragelocation, [ - {'id':8, 'name':'s3_us_west_1'}, + {'name':'s3_us_west_1'}, ]) diff --git a/data/migrations/versions/bcdde200a1b_add_placements_and_locations_to_the_db.py b/data/migrations/versions/bcdde200a1b_add_placements_and_locations_to_the_db.py index 9fc433126..310f1dff2 100644 --- a/data/migrations/versions/bcdde200a1b_add_placements_and_locations_to_the_db.py +++ b/data/migrations/versions/bcdde200a1b_add_placements_and_locations_to_the_db.py @@ -25,13 +25,13 @@ def upgrade(tables): op.bulk_insert(tables.imagestoragelocation, [ - {'id':1, 'name':'s3_us_east_1'}, - {'id':2, 'name':'s3_eu_west_1'}, - {'id':3, 'name':'s3_ap_southeast_1'}, - {'id':4, 'name':'s3_ap_southeast_2'}, - {'id':5, 'name':'s3_ap_northeast_1'}, - {'id':6, 'name':'s3_sa_east_1'}, - {'id':7, 'name':'local'}, + {'name':'s3_us_east_1'}, + {'name':'s3_eu_west_1'}, + {'name':'s3_ap_southeast_1'}, + {'name':'s3_ap_southeast_2'}, + {'name':'s3_ap_northeast_1'}, + {'name':'s3_sa_east_1'}, + {'name':'local'}, ]) op.create_table('imagestorageplacement',