chore: remove backend/alembic and backend/backend from git
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
Generic single-database configuration.
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
from logging.config import fileConfig
|
|
||||||
|
|
||||||
from sqlalchemy import engine_from_config
|
|
||||||
from sqlalchemy import pool
|
|
||||||
|
|
||||||
from alembic import context
|
|
||||||
|
|
||||||
# Import SQLModel and your models
|
|
||||||
from sqlmodel import SQLModel
|
|
||||||
from app.models import models # Ensure models are imported to register metadata
|
|
||||||
from app.core.config import settings
|
|
||||||
|
|
||||||
# this is the Alembic Config object, which provides
|
|
||||||
# access to the values within the .ini file in use.
|
|
||||||
config = context.config
|
|
||||||
|
|
||||||
# Interpret the config file for Python logging.
|
|
||||||
# This line sets up loggers basically.
|
|
||||||
if config.config_file_name is not None:
|
|
||||||
fileConfig(config.config_file_name)
|
|
||||||
|
|
||||||
# Set the SQLAlchemy URL from settings
|
|
||||||
config.set_main_option("sqlalchemy.url", settings.DATABASE_URL)
|
|
||||||
|
|
||||||
# target_metadata = None
|
|
||||||
target_metadata = SQLModel.metadata
|
|
||||||
|
|
||||||
# other values from the config, defined by the needs of env.py,
|
|
||||||
# can be acquired:
|
|
||||||
# my_important_option = config.get_main_option("my_important_option")
|
|
||||||
# ... etc.
|
|
||||||
|
|
||||||
|
|
||||||
def run_migrations_offline() -> None:
|
|
||||||
"""Run migrations in 'offline' mode.
|
|
||||||
|
|
||||||
This configures the context with just a URL
|
|
||||||
and not an Engine, though an Engine is acceptable
|
|
||||||
here as well. By skipping the Engine creation
|
|
||||||
we don't even need a DBAPI to be available.
|
|
||||||
|
|
||||||
Calls to context.execute() here emit the given string to the
|
|
||||||
script output.
|
|
||||||
|
|
||||||
"""
|
|
||||||
url = config.get_main_option("sqlalchemy.url")
|
|
||||||
context.configure(
|
|
||||||
url=url,
|
|
||||||
target_metadata=target_metadata,
|
|
||||||
literal_binds=True,
|
|
||||||
dialect_opts={"paramstyle": "named"},
|
|
||||||
)
|
|
||||||
|
|
||||||
with context.begin_transaction():
|
|
||||||
context.run_migrations()
|
|
||||||
|
|
||||||
|
|
||||||
def run_migrations_online() -> None:
|
|
||||||
"""Run migrations in 'online' mode.
|
|
||||||
|
|
||||||
In this scenario we need to create an Engine
|
|
||||||
and associate a connection with the context.
|
|
||||||
|
|
||||||
"""
|
|
||||||
connectable = engine_from_config(
|
|
||||||
config.get_section(config.config_ini_section, {}),
|
|
||||||
prefix="sqlalchemy.",
|
|
||||||
poolclass=pool.NullPool,
|
|
||||||
)
|
|
||||||
|
|
||||||
with connectable.connect() as connection:
|
|
||||||
context.configure(
|
|
||||||
connection=connection, target_metadata=target_metadata
|
|
||||||
)
|
|
||||||
|
|
||||||
with context.begin_transaction():
|
|
||||||
context.run_migrations()
|
|
||||||
|
|
||||||
|
|
||||||
if context.is_offline_mode():
|
|
||||||
run_migrations_offline()
|
|
||||||
else:
|
|
||||||
run_migrations_online()
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
"""${message}
|
|
||||||
|
|
||||||
Revision ID: ${up_revision}
|
|
||||||
Revises: ${down_revision | comma,n}
|
|
||||||
Create Date: ${create_date}
|
|
||||||
|
|
||||||
"""
|
|
||||||
from typing import Sequence, Union
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
${imports if imports else ""}
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision: str = ${repr(up_revision)}
|
|
||||||
down_revision: Union[str, Sequence[str], None] = ${repr(down_revision)}
|
|
||||||
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
|
|
||||||
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
|
||||||
"""Upgrade schema."""
|
|
||||||
${upgrades if upgrades else "pass"}
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
|
||||||
"""Downgrade schema."""
|
|
||||||
${downgrades if downgrades else "pass"}
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
"""Initial Full Schema
|
|
||||||
|
|
||||||
Revision ID: ca058f9ddb60
|
|
||||||
Revises:
|
|
||||||
Create Date: 2026-01-17 10:58:17.473117
|
|
||||||
|
|
||||||
"""
|
|
||||||
from typing import Sequence, Union
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision: str = 'ca058f9ddb60'
|
|
||||||
down_revision: Union[str, Sequence[str], None] = None
|
|
||||||
branch_labels: Union[str, Sequence[str], None] = None
|
|
||||||
depends_on: Union[str, Sequence[str], None] = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
|
||||||
"""Upgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.create_table('modelconfig',
|
|
||||||
sa.Column('provider', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('api_key', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('base_url', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
||||||
sa.Column('model_name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('model_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('is_active', sa.Boolean(), nullable=False),
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
op.create_table('project',
|
|
||||||
sa.Column('title', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('description', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
||||||
sa.Column('story_input', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
||||||
sa.Column('theme', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
||||||
sa.Column('language', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
||||||
sa.Column('panel_count', sa.Integer(), nullable=True),
|
|
||||||
sa.Column('aspect_ratio', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
||||||
sa.Column('id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
|
||||||
sa.Column('updated_at', sa.DateTime(), nullable=False),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
op.create_table('character',
|
|
||||||
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('data', sa.JSON(), nullable=True),
|
|
||||||
sa.Column('image_url', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('project_id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
op.create_table('globalconfig',
|
|
||||||
sa.Column('data', sa.JSON(), nullable=True),
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('project_id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
op.create_table('imagehistory',
|
|
||||||
sa.Column('entity_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('entity_id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('image_url', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('project_id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
|
||||||
sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
op.create_table('storyboarditem',
|
|
||||||
sa.Column('sequence', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('data', sa.JSON(), nullable=True),
|
|
||||||
sa.Column('image_url', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('project_id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
op.create_table('task',
|
|
||||||
sa.Column('type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('status', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('progress', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('message', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
||||||
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
||||||
sa.Column('description', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
||||||
sa.Column('result', sa.JSON(), nullable=True),
|
|
||||||
sa.Column('id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('project_id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
|
||||||
sa.Column('updated_at', sa.DateTime(), nullable=False),
|
|
||||||
sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
|
||||||
"""Downgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_table('task')
|
|
||||||
op.drop_table('storyboarditem')
|
|
||||||
op.drop_table('imagehistory')
|
|
||||||
op.drop_table('globalconfig')
|
|
||||||
op.drop_table('character')
|
|
||||||
op.drop_table('project')
|
|
||||||
op.drop_table('modelconfig')
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 822 KiB |
Reference in New Issue
Block a user