Add more drop defaults to prevent upgrade error

This commit is contained in:
Jeremy Zhang 2018-01-23 21:14:37 +00:00
parent aa199ad818
commit 0d54b8d588

View File

@ -25,9 +25,11 @@ def upgrade():
op.execute("ALTER TABLE authenticated_users ALTER COLUMN client_id TYPE BIGINT USING client_id::bigint") op.execute("ALTER TABLE authenticated_users ALTER COLUMN client_id TYPE BIGINT USING client_id::bigint")
op.execute("ALTER TABLE authenticated_users ALTER COLUMN guild_id DROP DEFAULT") op.execute("ALTER TABLE authenticated_users ALTER COLUMN guild_id DROP DEFAULT")
op.execute("ALTER TABLE authenticated_users ALTER COLUMN guild_id TYPE BIGINT USING guild_id::bigint") op.execute("ALTER TABLE authenticated_users ALTER COLUMN guild_id TYPE BIGINT USING guild_id::bigint")
op.execute("ALTER TABLE cosmetics ALTER COLUMN user_id DROP DEFAULT")
op.execute("ALTER TABLE cosmetics ALTER COLUMN user_id TYPE BIGINT USING user_id::bigint") op.execute("ALTER TABLE cosmetics ALTER COLUMN user_id TYPE BIGINT USING user_id::bigint")
op.drop_column('cosmetics', 'id') op.drop_column('cosmetics', 'id')
op.execute("ALTER TABLE cosmetics ADD PRIMARY KEY (user_id);") op.execute("ALTER TABLE cosmetics ADD PRIMARY KEY (user_id);")
op.execute("ALTER TABLE disabled_guilds ALTER COLUMN guild_id DROP DEFAULT")
op.execute("ALTER TABLE disabled_guilds ALTER COLUMN guild_id TYPE BIGINT USING guild_id::bigint") op.execute("ALTER TABLE disabled_guilds ALTER COLUMN guild_id TYPE BIGINT USING guild_id::bigint")
op.drop_column('disabled_guilds', 'id') op.drop_column('disabled_guilds', 'id')
op.execute("ALTER TABLE disabled_guilds ADD PRIMARY KEY (guild_id);") op.execute("ALTER TABLE disabled_guilds ADD PRIMARY KEY (guild_id);")
@ -49,20 +51,25 @@ def upgrade():
op.execute("ALTER TABLE messages ALTER COLUMN message_id TYPE BIGINT USING message_id::bigint") op.execute("ALTER TABLE messages ALTER COLUMN message_id TYPE BIGINT USING message_id::bigint")
op.drop_column('messages', 'id') op.drop_column('messages', 'id')
op.execute("ALTER TABLE messages ADD PRIMARY KEY (message_id);") op.execute("ALTER TABLE messages ADD PRIMARY KEY (message_id);")
op.execute("ALTER TABLE patreon ALTER COLUMN user_id DROP DEFAULT")
op.execute("ALTER TABLE patreon ALTER COLUMN user_id TYPE BIGINT USING user_id::bigint") op.execute("ALTER TABLE patreon ALTER COLUMN user_id TYPE BIGINT USING user_id::bigint")
op.drop_column('patreon', 'id') op.drop_column('patreon', 'id')
op.execute("ALTER TABLE patreon ADD PRIMARY KEY (user_id);") op.execute("ALTER TABLE patreon ADD PRIMARY KEY (user_id);")
op.execute("ALTER TABLE titan_tokens ALTER COLUMN user_id DROP DEFAULT")
op.execute("ALTER TABLE titan_tokens ALTER COLUMN user_id TYPE BIGINT USING user_id::bigint") op.execute("ALTER TABLE titan_tokens ALTER COLUMN user_id TYPE BIGINT USING user_id::bigint")
op.drop_column('titan_tokens', 'id') op.drop_column('titan_tokens', 'id')
op.execute("ALTER TABLE titan_tokens ADD PRIMARY KEY (user_id);") op.execute("ALTER TABLE titan_tokens ADD PRIMARY KEY (user_id);")
op.execute("ALTER TABLE token_transactions ALTER COLUMN user_id DROP DEFAULT")
op.execute("ALTER TABLE token_transactions ALTER COLUMN user_id TYPE BIGINT USING user_id::bigint") op.execute("ALTER TABLE token_transactions ALTER COLUMN user_id TYPE BIGINT USING user_id::bigint")
op.execute("ALTER TABLE unauthenticated_bans ALTER COLUMN guild_id DROP DEFAULT") op.execute("ALTER TABLE unauthenticated_bans ALTER COLUMN guild_id DROP DEFAULT")
op.execute("ALTER TABLE unauthenticated_bans ALTER COLUMN guild_id TYPE BIGINT USING guild_id::bigint") op.execute("ALTER TABLE unauthenticated_bans ALTER COLUMN guild_id TYPE BIGINT USING guild_id::bigint")
op.execute("ALTER TABLE unauthenticated_bans ALTER COLUMN lifter_id DROP DEFAULT")
op.execute("ALTER TABLE unauthenticated_bans ALTER COLUMN lifter_id TYPE BIGINT USING lifter_id::bigint") op.execute("ALTER TABLE unauthenticated_bans ALTER COLUMN lifter_id TYPE BIGINT USING lifter_id::bigint")
op.execute("ALTER TABLE unauthenticated_bans ALTER COLUMN placer_id DROP DEFAULT") op.execute("ALTER TABLE unauthenticated_bans ALTER COLUMN placer_id DROP DEFAULT")
op.execute("ALTER TABLE unauthenticated_bans ALTER COLUMN placer_id TYPE BIGINT USING placer_id::bigint") op.execute("ALTER TABLE unauthenticated_bans ALTER COLUMN placer_id TYPE BIGINT USING placer_id::bigint")
op.execute("ALTER TABLE unauthenticated_users ALTER COLUMN guild_id DROP DEFAULT") op.execute("ALTER TABLE unauthenticated_users ALTER COLUMN guild_id DROP DEFAULT")
op.execute("ALTER TABLE unauthenticated_users ALTER COLUMN guild_id TYPE BIGINT USING guild_id::bigint") op.execute("ALTER TABLE unauthenticated_users ALTER COLUMN guild_id TYPE BIGINT USING guild_id::bigint")
op.execute("ALTER TABLE user_css ALTER COLUMN user_id DROP DEFAULT")
op.execute("ALTER TABLE user_css ALTER COLUMN user_id TYPE BIGINT USING user_id::bigint") op.execute("ALTER TABLE user_css ALTER COLUMN user_id TYPE BIGINT USING user_id::bigint")
# ### end Alembic commands ### # ### end Alembic commands ###