mirror of
https://github.com/bellingcat/whisperbox-transcribe.git
synced 2026-06-12 21:48:35 +03:00
82 lines
2.5 KiB
Python
82 lines
2.5 KiB
Python
"""add_tables
|
|
|
|
Revision ID: 0eee2b7913b7
|
|
Revises:
|
|
Create Date: 2023-06-29 08:33:26.123728
|
|
|
|
"""
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "0eee2b7913b7"
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"jobs",
|
|
sa.Column("url", sa.String(length=2048), nullable=True),
|
|
sa.Column(
|
|
"status",
|
|
sa.Enum("create", "processing", "error", "success", name="jobstatus"),
|
|
nullable=False,
|
|
),
|
|
sa.Column("config", sa.JSON(none_as_null=True), nullable=True),
|
|
sa.Column("meta", sa.JSON(none_as_null=True), nullable=True),
|
|
sa.Column(
|
|
"type",
|
|
sa.Enum(
|
|
"transcript",
|
|
"translation",
|
|
"language_detection",
|
|
name="jobtype",
|
|
),
|
|
nullable=False,
|
|
),
|
|
sa.Column(
|
|
"created_at",
|
|
sa.DateTime(),
|
|
server_default=sa.text("(CURRENT_TIMESTAMP)"),
|
|
nullable=False,
|
|
),
|
|
sa.Column("updated_at", sa.DateTime(), nullable=True),
|
|
sa.Column("id", sa.VARCHAR(length=36), nullable=False),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index(op.f("ix_jobs_id"), "jobs", ["id"], unique=False)
|
|
op.create_table(
|
|
"artifacts",
|
|
sa.Column("job_id", sa.VARCHAR(length=36), nullable=False),
|
|
sa.Column("data", sa.JSON(none_as_null=True), nullable=True),
|
|
sa.Column(
|
|
"type",
|
|
sa.Enum("raw_transcript", "language_detection", name="artifacttype"),
|
|
nullable=False,
|
|
),
|
|
sa.Column(
|
|
"created_at",
|
|
sa.DateTime(),
|
|
server_default=sa.text("(CURRENT_TIMESTAMP)"),
|
|
nullable=False,
|
|
),
|
|
sa.Column("updated_at", sa.DateTime(), nullable=True),
|
|
sa.Column("id", sa.VARCHAR(length=36), nullable=False),
|
|
sa.ForeignKeyConstraint(["job_id"], ["jobs.id"], ondelete="CASCADE"),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index(op.f("ix_artifacts_id"), "artifacts", ["id"], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f("ix_artifacts_id"), table_name="artifacts")
|
|
op.drop_table("artifacts")
|
|
op.drop_index(op.f("ix_jobs_id"), table_name="jobs")
|
|
op.drop_table("jobs")
|
|
# ### end Alembic commands ###
|