"""update db to match models at fork time

Revision ID: 4a1f7859151b
Revises: 0aef77162269
Create Date: 2022-05-12 03:08:32.417479+00:00

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '4a1f7859151b'
down_revision = '0aef77162269'
branch_labels = None
depends_on = None


def upgrade():
	# ### commands auto generated by Alembic - please adjust! ###
	op.add_column('submissions', sa.Column('bump_utc', sa.Integer(), server_default=sa.schema.FetchedValue(), nullable=True))
	op.create_foreign_key('comments_app_id_fkey', 'comments', 'oauth_apps', ['app_id'], ['id'])
	op.create_foreign_key('commentvotes_app_id_fkey', 'commentvotes', 'oauth_apps', ['app_id'], ['id'])
	op.create_foreign_key('modactions_user_id_fkey', 'modactions', 'users', ['user_id'], ['id'])
	op.create_foreign_key('submissions_app_id_fkey', 'submissions', 'oauth_apps', ['app_id'], ['id'])
	op.create_foreign_key('votes_app_id_fkey', 'votes', 'oauth_apps', ['app_id'], ['id'])
	# ### end Alembic commands ###


def downgrade():
	# ### commands auto generated by Alembic - please adjust! ###
	op.drop_constraint('votes_app_id_fkey', 'votes', type_='foreignkey')
	op.drop_constraint('submissions_app_id_fkey', 'submissions', type_='foreignkey')
	op.drop_constraint('modactions_user_id_fkey', 'modactions', type_='foreignkey')
	op.drop_constraint('commentvotes_app_id_fkey', 'commentvotes', type_='foreignkey')
	op.drop_constraint('comments_app_id_fkey', 'comments', type_='foreignkey')
	op.drop_column('submissions', 'bump_utc')
	# ### end Alembic commands ###
