feat: PocketVeto v1.0.0 — initial public release
Self-hosted US Congress monitoring platform with AI policy briefs, bill/member/topic follows, ntfy + RSS + email notifications, alignment scoring, collections, and draft-letter generator. Authored by: Jack Levy
This commit is contained in:
52
backend/alembic/versions/0015_add_collections.py
Normal file
52
backend/alembic/versions/0015_add_collections.py
Normal file
@@ -0,0 +1,52 @@
|
||||
"""Add collections and collection_bills tables
|
||||
|
||||
Revision ID: 0015
|
||||
Revises: 0014
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = "0015"
|
||||
down_revision = "0014"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
"collections",
|
||||
sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True),
|
||||
sa.Column("user_id", sa.Integer(), sa.ForeignKey("users.id", ondelete="CASCADE"), nullable=False),
|
||||
sa.Column("name", sa.String(100), nullable=False),
|
||||
sa.Column("slug", sa.String(120), nullable=False),
|
||||
sa.Column("is_public", sa.Boolean(), nullable=False, server_default="false"),
|
||||
sa.Column(
|
||||
"share_token",
|
||||
postgresql.UUID(as_uuid=False),
|
||||
nullable=False,
|
||||
server_default=sa.text("gen_random_uuid()"),
|
||||
),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
||||
sa.UniqueConstraint("share_token", name="uq_collections_share_token"),
|
||||
sa.UniqueConstraint("user_id", "slug", name="uq_collections_user_slug"),
|
||||
)
|
||||
op.create_index("ix_collections_user_id", "collections", ["user_id"])
|
||||
op.create_index("ix_collections_share_token", "collections", ["share_token"])
|
||||
|
||||
op.create_table(
|
||||
"collection_bills",
|
||||
sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True),
|
||||
sa.Column("collection_id", sa.Integer(), sa.ForeignKey("collections.id", ondelete="CASCADE"), nullable=False),
|
||||
sa.Column("bill_id", sa.String(), sa.ForeignKey("bills.bill_id", ondelete="CASCADE"), nullable=False),
|
||||
sa.Column("added_at", sa.DateTime(timezone=True), server_default=sa.func.now()),
|
||||
sa.UniqueConstraint("collection_id", "bill_id", name="uq_collection_bills_collection_bill"),
|
||||
)
|
||||
op.create_index("ix_collection_bills_collection_id", "collection_bills", ["collection_id"])
|
||||
op.create_index("ix_collection_bills_bill_id", "collection_bills", ["bill_id"])
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table("collection_bills")
|
||||
op.drop_table("collections")
|
||||
Reference in New Issue
Block a user