"""kworb_youtube_weekly Revision ID: a54c59983d1a Revises: d95b2478c7e3 Create Date: 2021-02-12 14:48:49.131101 """ # revision identifiers, used by Alembic. revision = 'a54c59983d1a' down_revision = 'd95b2478c7e3' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql def upgrade(): op.execute(''' create table kworb_youtube_weekly_charts ( country_code varchar(2) not null, as_of date not null, position integer not null, title varchar not null, position_change integer, streams integer, streams_change integer ) partition by range(as_of); create table kworb_youtube_weekly_charts_default partition of kworb_youtube_weekly_charts default; create unique index on kworb_youtube_weekly_charts_default (as_of, country_code, position); ''') def downgrade(): op.drop_table('kworb_youtube_weekly_charts') # ### end Alembic commands ###