def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('frameworks', sa.Column('application_close_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True)) op.alter_column('frameworks', 'intention_to_award_at_utc', existing_type=postgresql.TIMESTAMP(), nullable=True) op.alter_column('frameworks', 'framework_live_at_utc', existing_type=postgresql.TIMESTAMP(), nullable=True) op.alter_column('frameworks', 'framework_expires_at_utc', existing_type=postgresql.TIMESTAMP(), nullable=True) op.alter_column('frameworks', 'clarifications_publish_at_utc', existing_type=postgresql.TIMESTAMP(), nullable=True) op.alter_column('frameworks', 'clarifications_close_at_utc', existing_type=postgresql.TIMESTAMP(), nullable=True) op.alter_column('frameworks', 'applications_close_at_utc', existing_type=postgresql.TIMESTAMP(), nullable=True)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'batches_versions', sa.Column('version_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('batch_token', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['batch_token'], ['batch.token'], name='batches_versions_batch_token_fkey'), sa.ForeignKeyConstraint(['version_id'], ['versions.id'], name='batches_versions_version_id_fkey')) op.create_table( 'batch', sa.Column('token', sa.INTEGER(), nullable=False), sa.Column('started_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('token', name='batch_pkey'))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "posts", sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False), sa.Column("title", sa.VARCHAR(length=64), autoincrement=False, nullable=True), sa.Column("author_id", sa.INTEGER(), autoincrement=False, nullable=True), sa.Column("slug", sa.VARCHAR(length=128), autoincrement=False, nullable=True), sa.Column("date", sa.VARCHAR(length=64), autoincrement=False, nullable=True), sa.Column("content", sa.TEXT(), autoincrement=False, nullable=True), sa.Column( "timestamp", postgresql.TIMESTAMP(), autoincrement=False, nullable=True ), sa.ForeignKeyConstraint( ["author_id"], ["user.id"], name="posts_author_id_fkey" ), sa.PrimaryKeyConstraint("id", name="posts_pkey"), ) op.create_index("ix_posts_title", "posts", ["title"], unique=False) op.create_index("ix_posts_timestamp", "posts", ["timestamp"], unique=False) op.drop_table("collect") op.drop_index(op.f("ix_post_title"), table_name="post") op.drop_index(op.f("ix_post_timestamp"), table_name="post") op.drop_table("post")
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( 'members', sa.Column('membership_type', sa.VARCHAR(), autoincrement=False, nullable=False)) op.create_table( 'customer_relationships', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('date_added', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), sa.Column('business_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('member_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('active', sa.BOOLEAN(), autoincrement=False, nullable=False), sa.Column('membership_type', sa.VARCHAR(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint( ['business_id'], ['businesses.id'], name='customer_relationships_business_id_fkey'), sa.ForeignKeyConstraint(['member_id'], ['members.id'], name='customer_relationships_member_id_fkey'), sa.PrimaryKeyConstraint('id', name='customer_relationships_pkey')) op.drop_table('member_relationships') op.drop_table('membership_types')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'post', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('body', sa.VARCHAR(length=999), autoincrement=False, nullable=True), sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('sender', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('receiver', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['receiver'], ['users.id'], name='post_receiver_fkey'), sa.ForeignKeyConstraint(['sender'], ['users.id'], name='post_sender_fkey'), sa.PrimaryKeyConstraint('id', name='post_pkey')) op.create_index('ix_post_timestamp', 'post', ['timestamp'], unique=False) op.drop_index(op.f('ix_messages_timestamp'), table_name='messages') op.drop_table('messages')
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.get_bind() query = 'update templates_history set created_by_id = ' \ '(select created_by_id from templates where templates.id = templates_history.id) ' \ 'where created_by_id is null' op.execute(query) op.execute('update templates_history set archived = False') op.alter_column('api_keys_history', 'created_at', existing_type=postgresql.TIMESTAMP(), nullable=False) op.alter_column('api_keys_history', 'created_by_id', existing_type=postgresql.UUID(), nullable=False) op.alter_column('templates_history', 'archived', existing_type=sa.BOOLEAN(), nullable=False) op.alter_column('templates_history', 'created_by_id', existing_type=postgresql.UUID(), nullable=False)
class Session(Base): __tablename__ = 'django_session' session_key = sa.Column( postgresql_types.VARCHAR(length=40), primary_key=True, unique=True, nullable=False, doc="testtest", ) session_data = sa.Column( postgresql_types.TEXT(), primary_key=False, unique=False, nullable=False, doc="testtest", ) expire_date = sa.Column( postgresql_types.TIMESTAMP(), primary_key=False, unique=False, nullable=False, doc="testtest", )
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'LatestFetch', sa.Column('id', sa.INTEGER(), server_default=sa.text( 'nextval(\'"LatestFetch_id_seq"\'::regclass)'), autoincrement=True, nullable=False), sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('fetch_type', sa.VARCHAR(length=20), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='LatestFetch_pkey')) op.create_index('ix_LatestFetch_timestamp', 'LatestFetch', ['timestamp'], unique=False) op.drop_index(op.f('ix_FetchLog_timestamp'), table_name='FetchLog') op.drop_table('FetchLog')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( 'Show', sa.Column('venue_name', sa.VARCHAR(length=120), autoincrement=False, nullable=True)) op.add_column( 'Show', sa.Column('image_link', sa.VARCHAR(length=500), autoincrement=False, nullable=True)) op.add_column( 'Show', sa.Column('artist_name', sa.VARCHAR(length=120), autoincrement=False, nullable=True)) op.alter_column('Show', 'start_time', existing_type=postgresql.TIMESTAMP(), nullable=False)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('customer', 'videos_checked_out_count') op.create_table( 'rental', sa.Column('rental_id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('customer_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('video_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('due_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['customer_id'], ['customer.customer_id'], name='rental_customer_id_fkey'), sa.ForeignKeyConstraint(['video_id'], ['video.video_id'], name='rental_video_id_fkey'), sa.PrimaryKeyConstraint('rental_id', name='rental_pkey'))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('specimen', 'measurement', existing_type=postgresql.ENUM('qubit', 'nanodrop', name='measurement_enum'), nullable=False) op.alter_column('specimen', 'dna', existing_type=postgresql.DOUBLE_PRECISION(precision=53), nullable=False) op.alter_column('specimen', 'date_collected', existing_type=postgresql.TIMESTAMP(), nullable=False) op.alter_column('sample', 'subspecies_id', existing_type=sa.INTEGER(), nullable=False) op.alter_column('sample', 'lineage_id', existing_type=sa.INTEGER(), nullable=False)
def downgrade(): op.create_table( 'remoteentity', sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False), sa.Column('type', sa.VARCHAR(), autoincrement=False, nullable=False), sa.Column('provider', sa.VARCHAR(length=128), autoincrement=False, nullable=False), sa.Column('remote_id', sa.VARCHAR(length=128), autoincrement=False, nullable=False), sa.Column('internal_id', postgresql.UUID(), autoincrement=False, nullable=False), sa.Column('data', sa.VARCHAR(), autoincrement=False, nullable=True), sa.Column('date_created', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name=u'remoteentity_pkey'))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'bug', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('bug_tracker_url', sa.VARCHAR(), autoincrement=False, nullable=False), sa.Column('root_cause', sa.VARCHAR(), autoincrement=False, nullable=True), sa.Column('who', sa.VARCHAR(), autoincrement=False, nullable=True), sa.Column('when', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='bug_pkey')) op.drop_index(op.f('ix_Bug_root_cause_id'), table_name='Bug') op.drop_table('Bug') op.drop_table('Root_Cause')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'user_profile', sa.Column('userid', sa.INTEGER(), nullable=False), sa.Column('file', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('username', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('first_name', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('last_name', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('age', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('gender', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('biography', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('date_created', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('userid', name=u'user_profile_pkey'), sa.UniqueConstraint('username', name=u'user_profile_username_key')) op.drop_table('profile')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( 'users', sa.Column('last_updated_time', postgresql.TIMESTAMP(), autoincrement=False, nullable=False)) op.add_column( 'users', sa.Column('public_id', sa.VARCHAR(length=50), autoincrement=False, nullable=True)) op.drop_constraint(None, 'users', type_='unique') op.create_unique_constraint('users_public_id_key', 'users', ['public_id']) op.alter_column('users', 'password', existing_type=sa.VARCHAR(length=255), nullable=True) op.drop_column('users', 'username') op.drop_column('users', 'last_modified_time') op.drop_constraint(None, 'blacklisted_token', type_='unique') op.drop_table('trusted_contacts')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'shows', sa.Column('artist_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('venue_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('start_time', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['artist_id'], ['Artist.id'], name='shows_artist_id_fkey'), sa.ForeignKeyConstraint(['venue_id'], ['Venue.id'], name='shows_venue_id_fkey'), sa.PrimaryKeyConstraint('artist_id', 'venue_id', name='shows_pkey')) op.drop_table('venue_shows') op.drop_table('artist_shows') op.drop_table('Show')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'pings', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('from_ip', sa.VARCHAR(length=120), autoincrement=False, nullable=True), sa.Column('host', sa.VARCHAR(length=120), autoincrement=False, nullable=True), sa.Column('time_stamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('isdown', sa.BOOLEAN(), autoincrement=False, nullable=True), sa.Column('response_code', sa.INTEGER(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='pings_pkey')) op.drop_table('ping')
def downgrade(): op.alter_column('nodes', 'user_id', existing_type=sa.INTEGER(), nullable=True) op.alter_column('nodes', 'typename', existing_type=sa.INTEGER(), nullable=True) op.alter_column('nodes', 'name', existing_type=sa.VARCHAR(length=255), server_default=None, nullable=True) op.alter_column('nodes', 'hyperdata', existing_type=postgresql.JSONB(astext_type=sa.Text()), server_default=None, nullable=True) op.alter_column('nodes', 'date', existing_type=postgresql.TIMESTAMP(timezone=True), server_default=None, nullable=True)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( 'payment_account_version', sa.Column('running_balance', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True)) op.add_column( 'payment_account', sa.Column('running_balance', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True)) op.add_column( 'payment', sa.Column('created_on', postgresql.TIMESTAMP(), autoincrement=False, nullable=True)) op.drop_index(op.f('ix_credits_cfs_identifier'), table_name='credits') op.drop_index(op.f('ix_credits_account_id'), table_name='credits') op.drop_table('credits')
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column( 'users', sa.Column('email', sa.VARCHAR(length=80), autoincrement=False, nullable=False)) op.add_column( 'users', sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=False)) op.create_unique_constraint(u'users_email_key', 'users', ['email']) op.add_column( 'roles', sa.Column('name', sa.VARCHAR(length=80), autoincrement=False, nullable=False)) op.drop_constraint(None, 'roles', type_='unique') op.create_unique_constraint(u'roles_name_key', 'roles', ['name']) op.drop_column('roles', 'title')
def upgrade(): op.alter_column('nodes', 'date', existing_type=postgresql.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False) op.alter_column('nodes', 'hyperdata', existing_type=postgresql.JSONB(astext_type=sa.Text()), server_default=sa.text("'{}'::jsonb"), nullable=False) op.alter_column('nodes', 'name', existing_type=sa.VARCHAR(length=255), server_default='', nullable=False) op.alter_column('nodes', 'typename', existing_type=sa.INTEGER(), nullable=False) op.alter_column('nodes', 'user_id', existing_type=sa.INTEGER(), nullable=False)
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('Venue', 'website') op.drop_column('Venue', 'upcoming_shows_count') op.drop_column('Venue', 'seeking_talent') op.drop_column('Venue', 'seeking_description') op.drop_column('Venue', 'past_shows_count') op.drop_column('Venue', 'image_link') op.drop_column('Venue', 'genres') op.drop_column('Artist', 'website') op.drop_column('Artist', 'upcoming_shows_count') op.drop_column('Artist', 'seeking_venue') op.drop_column('Artist', 'seeking_description') op.drop_column('Artist', 'past_shows_count') op.drop_column('Artist', 'image_link') op.create_table('Show', sa.Column('venue_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('artist_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('start_time', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['artist_id'], ['Artist.id'], name='Show_artist_id_fkey'), sa.ForeignKeyConstraint(['venue_id'], ['Venue.id'], name='Show_venue_id_fkey'), sa.PrimaryKeyConstraint('venue_id', 'artist_id', name='Show_pkey') ) op.drop_table('shows')
def downgrade(): op.create_table( 'db_dbcalcstate', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('dbnode_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('state', sa.VARCHAR(length=255), autoincrement=False, nullable=True), sa.Column('time', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['dbnode_id'], [u'db_dbnode.id'], name=u'db_dbcalcstate_dbnode_id_fkey', ondelete=u'CASCADE', initially=u'DEFERRED', deferrable=True), sa.PrimaryKeyConstraint('id', name=u'db_dbcalcstate_pkey'), sa.UniqueConstraint('dbnode_id', 'state', name=u'db_dbcalcstate_dbnode_id_state_key'))
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table( 'comment', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('name', sa.VARCHAR(length=30), autoincrement=False, nullable=True), sa.Column('ip', sa.VARCHAR(length=20), autoincrement=False, nullable=True), sa.Column('body', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('datetime', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('original_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['original_id'], ['post.id'], name='comment_original_id_fkey'), sa.PrimaryKeyConstraint('id', name='comment_pkey'))
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('comment', 'image') op.create_table( 'ticket_image', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('image', sa.VARCHAR(length=500), autoincrement=False, nullable=True), sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('ticket_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['ticket_id'], ['ticket.id'], name='ticket_image_ticket_id_fkey'), sa.ForeignKeyConstraint(['user_id'], ['user.id'], name='ticket_image_user_id_fkey'), sa.PrimaryKeyConstraint('id', name='ticket_image_pkey'))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( 'artists', sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False)) op.add_column( 'shows', sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False)) op.alter_column('shows', 'start_time', existing_type=postgresql.TIMESTAMP(), nullable=False) op.add_column( 'venues', sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False))
def upgrade(): op.execute( 'update account_fees set created_on = now() where created_on is null') op.execute( "update account_fees set created_by = 'SYSTEM' where created_by is null" ) # ### commands auto generated by Alembic - please adjust! ### op.alter_column('account_fees', 'created_on', existing_type=postgresql.TIMESTAMP(), nullable=False) op.alter_column('account_fees', 'created_by', existing_type=sa.VARCHAR(length=50), nullable=False) # Remove hand made indexes. op.execute('DROP INDEX IF EXISTS invoices_payment_method_code_idx') op.create_index(op.f('ix_invoices_payment_method_code'), 'invoices', ['payment_method_code'], unique=False) op.execute('DROP INDEX IF EXISTS routing_slips_status_idx') op.create_index(op.f('ix_routing_slips_status'), 'routing_slips', ['status'], unique=False)
def downgrade(): op.create_table( 'checkpoints', sa.Column( 'id', sa.INTEGER(), server_default=sa.text( u"nextval('pgcontents.checkpoints_id_seq'::regclass)" ), nullable=False, ), sa.Column( 'file_id', sa.INTEGER(), autoincrement=False, nullable=False, ), sa.Column( 'created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=False ), sa.ForeignKeyConstraint( ['file_id'], [u'pgcontents.files.id'], name=u'checkpoints_file_id_fkey', onupdate=u'CASCADE', ondelete=u'CASCADE' ), sa.PrimaryKeyConstraint( 'id', name=u'checkpoints_pkey' ), schema='pgcontents', )
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'article', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('source', sa.VARCHAR(), autoincrement=False, nullable=False), sa.Column('url', sa.VARCHAR(), autoincrement=False, nullable=False), sa.Column('category', sa.VARCHAR(), autoincrement=False, nullable=False), sa.Column('date', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), sa.Column('title', sa.VARCHAR(), autoincrement=False, nullable=False), sa.Column('content', sa.VARCHAR(), autoincrement=False, nullable=False), sa.Column('tags', sa.VARCHAR(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='article_pkey')) op.create_index('ix_article_id', 'article', ['id'], unique=False) op.drop_index(op.f('ix_user_id'), table_name='user') op.drop_index(op.f('ix_user_email'), table_name='user') op.drop_table('user')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( 'user_version', sa.Column('updated_on', postgresql.TIMESTAMP(), server_default=sa.text('now()'), autoincrement=False, nullable=True)) op.add_column( 'user', sa.Column('created_on', postgresql.TIMESTAMP(), autoincrement=False, nullable=True)) op.add_column( 'run_version', sa.Column('updated_on', postgresql.TIMESTAMP(), server_default=sa.text('now()'), autoincrement=False, nullable=True)) op.add_column( 'run', sa.Column('created_on', postgresql.TIMESTAMP(), autoincrement=False, nullable=True)) op.add_column( 'protocol_version', sa.Column('updated_on', postgresql.TIMESTAMP(), server_default=sa.text('now()'), autoincrement=False, nullable=True)) op.add_column( 'protocol', sa.Column('created_on', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))