Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53fe03fb2d | ||
|
|
c414708b32 | ||
|
|
443a128ad7 |
No files matched your search
@@ -28,12 +28,19 @@ def upgrade() -> None:
|
|||||||
sa.Column("logo_url", sa.String(), nullable=True),
|
sa.Column("logo_url", sa.String(), nullable=True),
|
||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
)
|
)
|
||||||
|
# batch_alter_table's alter_column doesn't emit CREATE TYPE for the new
|
||||||
|
# Enum on its own (unlike create_table, which ties enum creation to the
|
||||||
|
# table-create DDL event) - create it explicitly first, or Postgres fails
|
||||||
|
# with `type "uncseries" does not exist`. checkfirst / no-op on SQLite.
|
||||||
|
uncseries = sa.Enum("UNC", "UNF", "UNEF", "UN", "UNS", name="uncseries")
|
||||||
|
uncseries.create(op.get_bind(), checkfirst=True)
|
||||||
with op.batch_alter_table("unc_threads", schema=None) as batch_op:
|
with op.batch_alter_table("unc_threads", schema=None) as batch_op:
|
||||||
batch_op.alter_column(
|
batch_op.alter_column(
|
||||||
"series",
|
"series",
|
||||||
existing_type=sa.VARCHAR(length=8),
|
existing_type=sa.VARCHAR(length=8),
|
||||||
type_=sa.Enum("UNC", "UNF", "UNEF", "UN", "UNS", name="uncseries"),
|
type_=uncseries,
|
||||||
existing_nullable=False,
|
existing_nullable=False,
|
||||||
|
postgresql_using="series::uncseries",
|
||||||
)
|
)
|
||||||
|
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
@@ -47,7 +54,9 @@ def downgrade() -> None:
|
|||||||
existing_type=sa.Enum("UNC", "UNF", "UNEF", "UN", "UNS", name="uncseries"),
|
existing_type=sa.Enum("UNC", "UNF", "UNEF", "UN", "UNS", name="uncseries"),
|
||||||
type_=sa.VARCHAR(length=8),
|
type_=sa.VARCHAR(length=8),
|
||||||
existing_nullable=False,
|
existing_nullable=False,
|
||||||
|
postgresql_using="series::varchar(8)",
|
||||||
)
|
)
|
||||||
|
sa.Enum(name="uncseries").drop(op.get_bind(), checkfirst=True)
|
||||||
|
|
||||||
op.drop_table("manufacturers")
|
op.drop_table("manufacturers")
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
@@ -8,5 +8,5 @@ class Manufacturer(Base):
|
|||||||
|
|
||||||
id: Mapped[int] = mapped_column(primary_key=True)
|
id: Mapped[int] = mapped_column(primary_key=True)
|
||||||
name: Mapped[str] = mapped_column(nullable=False)
|
name: Mapped[str] = mapped_column(nullable=False)
|
||||||
url: Mapped[str] = mapped_column(nullable=False)
|
url: Mapped[str] = mapped_column(nullable=True)
|
||||||
logo_url: Mapped[str | None] = mapped_column(nullable=True, default=None)
|
logo_url: Mapped[str | None] = mapped_column(nullable=True, default=None)
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Idempotent: creates perms/roles/superuser only if missing.
|
# Idempotent: creates perms/roles/superuser only if missing.
|
||||||
|
uv run alembic upgrade head
|
||||||
uv run python -m scripts.seed
|
uv run python -m scripts.seed
|
||||||
|
|
||||||
exec uv run uvicorn app.main:app --host 0.0.0.0 --port 8000
|
exec uv run uvicorn app.main:app --host 0.0.0.0 --port 8000
|
||||||
Reference in new issue
Block a user