Skip to content

Commit a1da1d1

Browse files
michelle-hadfield-navayoomlamCopilot
authored
FEAT: add support listing data model (#17)
Co-authored-by: Yoom Lam <yoom@navapbc.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 31e66d4 commit a1da1d1

3 files changed

Lines changed: 79 additions & 2 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
"""create support listing table
2+
3+
Revision ID: 4d134292e5e3
4+
Revises: 4ff1160282d1
5+
Create Date: 2025-09-03 15:56:17.655320
6+
7+
"""
8+
import sqlalchemy as sa
9+
from alembic import op
10+
11+
# revision identifiers, used by Alembic.
12+
revision = "4d134292e5e3"
13+
down_revision = "4ff1160282d1"
14+
branch_labels = None
15+
depends_on = None
16+
17+
18+
def upgrade():
19+
# ### commands auto generated by Alembic - please adjust! ###
20+
op.create_table(
21+
"support_listing",
22+
sa.Column(
23+
"name",
24+
sa.Text(),
25+
nullable=False,
26+
comment="name of the support listing; a human-readable identifier",
27+
),
28+
sa.Column(
29+
"uri",
30+
sa.Text(),
31+
nullable=False,
32+
comment="origin of the Support Listing; a file path or a website URL",
33+
),
34+
sa.Column("id", sa.UUID(), nullable=False),
35+
sa.Column(
36+
"created_at",
37+
sa.TIMESTAMP(timezone=True),
38+
server_default=sa.text("now()"),
39+
nullable=False,
40+
),
41+
sa.Column(
42+
"updated_at",
43+
sa.TIMESTAMP(timezone=True),
44+
server_default=sa.text("now()"),
45+
nullable=False,
46+
),
47+
sa.PrimaryKeyConstraint("id", name=op.f("support_listing_pkey")),
48+
sa.UniqueConstraint("name", name=op.f("support_listing_name_uniq")),
49+
)
50+
# ### end Alembic commands ###
51+
52+
53+
def downgrade():
54+
# ### commands auto generated by Alembic - please adjust! ###
55+
op.drop_table("support_listing")
56+
# ### end Alembic commands ###

app/src/db/models/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import logging
22

3-
from . import base, user_models
3+
from src.db.models import base, support_listing, user_models
44

55
logger = logging.getLogger(__name__)
66

77
# Re-export metadata
88
# This is used by tests to create the test database.
99
metadata = base.metadata
1010

11-
__all__ = ["metadata", "user_models"]
11+
__all__ = ["metadata", "user_models", "support_listing"]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import logging
2+
3+
from sqlalchemy.orm import Mapped, mapped_column
4+
5+
from src.db.models.base import Base, IdMixin, TimestampMixin
6+
7+
logger = logging.getLogger(__name__)
8+
9+
10+
class SupportListing(Base, IdMixin, TimestampMixin):
11+
__tablename__ = "support_listing"
12+
13+
name: Mapped[str] = mapped_column(
14+
nullable=False,
15+
unique=True,
16+
comment="name of the support listing; a human-readable identifier",
17+
)
18+
uri: Mapped[str] = mapped_column(
19+
nullable=False,
20+
comment="origin of the Support Listing; a file path or a website URL",
21+
)

0 commit comments

Comments
 (0)