"""sc_track_olap Revision ID: e6ccbc6f122f Revises: 161405e5d7ef Create Date: 2020-11-27 09:59:55.409283 """ # revision identifiers, used by Alembic. revision = 'e6ccbc6f122f' down_revision = '161405e5d7ef' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('sc_track_olap', sa.Column('track_scid', sa.Integer(), nullable=False), sa.Column('num_days', sa.Integer(), nullable=False), sa.Column('total_plays', sa.Integer(), nullable=False), sa.Column('max_daily_plays', sa.Integer(), nullable=False), sa.Column('min_daily_plays', sa.Integer(), nullable=False), sa.Column('avg_daily_plays', sa.Float(), nullable=False), sa.Column('plays_yesterday', sa.Integer(), nullable=False), sa.Column('idates', postgresql.ARRAY(sa.Integer()), nullable=False), sa.Column('daily_plays', postgresql.ARRAY(sa.Integer()), nullable=False), sa.Column('slope15', sa.Float(), nullable=False), sa.Column('rsq15', sa.Float(), nullable=False), sa.Column('yint15', sa.Float(), nullable=False), sa.Column('slope22', sa.Float(), nullable=True), sa.Column('rsq22', sa.Float(), nullable=True), sa.Column('yint22', sa.Float(), nullable=True), sa.Column('slope29', sa.Float(), nullable=True), sa.Column('rsq29', sa.Float(), nullable=True), sa.Column('yint29', sa.Float(), nullable=True), sa.Column('most_recent_stat', sa.Date(), nullable=False), sa.Column('artist_scid', sa.Integer(), nullable=False, server_default=sa.text('0')), sa.Column('data_user_id', sa.Integer(), nullable=True), sa.Column('last_comment_count', sa.Integer(), nullable=True), sa.Column('last_favoritings_count', sa.Integer(), nullable=True), sa.Column('last_followers_count', sa.Integer(), nullable=True), sa.Column('last_followings_count', sa.Integer(), nullable=True), sa.Column('last_track_count', sa.Integer(), nullable=True), sa.Column('created_at', sa.Date(), nullable=False), sa.Column('country_iso2', sa.String(length=2), nullable=True), sa.PrimaryKeyConstraint('track_scid') ) op.create_index('ix_sc_track_olap_15', 'sc_track_olap', ['num_days', 'slope15', 'rsq15', 'plays_yesterday'], unique=False) op.create_index('ix_sc_track_olap_22', 'sc_track_olap', ['num_days', 'slope22', 'rsq22', 'plays_yesterday'], unique=False) op.create_index('ix_sc_track_olap_29', 'sc_track_olap', ['num_days', 'slope29', 'rsq29', 'plays_yesterday'], unique=False) def downgrade(): op.drop_index('ix_sc_track_olap_29', table_name='sc_track_olap') op.drop_index('ix_sc_track_olap_22', table_name='sc_track_olap') op.drop_index('ix_sc_track_olap_15', table_name='sc_track_olap') op.drop_table('sc_track_olap') # sticking these here for reference as I might not be able to generate them next time. def _drop_other_table(): op.drop_index('ix_sc_track_regressions_15', table_name='sc_track_regressions') op.drop_index('ix_sc_track_regressions_22', table_name='sc_track_regressions') op.drop_index('ix_sc_track_regressions_29', table_name='sc_track_regressions') op.drop_table('sc_track_regressions') def _undo_drop_other_table(): op.create_table('sc_track_regressions', sa.Column('track_scid', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('num_days', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('total_plays', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('max_daily_plays', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('min_daily_plays', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('avg_daily_plays', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), sa.Column('plays_yesterday', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('idates', postgresql.ARRAY(sa.INTEGER()), autoincrement=False, nullable=True), sa.Column('daily_plays', postgresql.ARRAY(sa.INTEGER()), autoincrement=False, nullable=True), sa.Column('slope15', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), sa.Column('rsq15', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), sa.Column('yint15', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), sa.Column('slope22', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), sa.Column('rsq22', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), sa.Column('yint22', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), sa.Column('slope29', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), sa.Column('rsq29', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), sa.Column('yint29', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), sa.Column('most_recent_stat', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['track_scid'], ['sc_tracks.scid'], name='fk_sc_track_regressions'), sa.PrimaryKeyConstraint('track_scid', name='sc_track_regressions_pkey') ) op.create_index('ix_sc_track_regressions_29', 'sc_track_regressions', ['num_days', 'slope29', 'rsq29', 'plays_yesterday'], unique=False) op.create_index('ix_sc_track_regressions_22', 'sc_track_regressions', ['num_days', 'slope22', 'rsq22', 'plays_yesterday'], unique=False) op.create_index('ix_sc_track_regressions_15', 'sc_track_regressions', ['num_days', 'slope15', 'rsq15', 'plays_yesterday'], unique=False)