diff --git a/migrations/versions/2022_05_22_21_59_30_dd9a3c418274_add_filter_state_and_update_flags_schema.py b/migrations/versions/2022_05_22_21_59_30_dd9a3c418274_add_filter_state_and_update_flags_schema.py new file mode 100644 index 000000000..0f29b5284 --- /dev/null +++ b/migrations/versions/2022_05_22_21_59_30_dd9a3c418274_add_filter_state_and_update_flags_schema.py @@ -0,0 +1,28 @@ +"""Add filter_state and update flags schema + +Revision ID: dd9a3c418274 +Revises: 16d6335dd9a3 +Create Date: 2022-05-22 21:59:30.104333+00:00 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'dd9a3c418274' +down_revision = '16d6335dd9a3' +branch_labels = None +depends_on = None + + +def upgrade(): + op.add_column('submissions', sa.Column('filter_state', sa.String(40), nullable=False)) + op.drop_constraint('flags_pkey', 'flags') + op.add_column('flags', sa.Column('id', sa.Integer, nullable=False, primary_key=True, autoincrement=True)) + + +def downgrade(): + op.drop_column('submissions', 'filter_state') + op.drop_column('flags', 'id') + op.create_primary_key('flags_id_pk', 'flags', ['post_id', 'user_id']) diff --git a/schema.sql b/schema.sql index e1beb5bd5..e5d7846dd 100644 --- a/schema.sql +++ b/schema.sql @@ -895,14 +895,6 @@ ALTER TABLE ONLY public.exiles ADD CONSTRAINT exiles_pkey PRIMARY KEY (user_id, sub); --- --- Name: flags flags_pkey; Type: CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.flags - ADD CONSTRAINT flags_pkey PRIMARY KEY (post_id, user_id); - - -- -- Name: follows follows_pkey; Type: CONSTRAINT; Schema: public; Owner: - --