Initial MVP: local visual novel library with Ren'Py → PGVN converter
- FastAPI backend: admin bootstrap with forced credential change, admin-created users with one-time generated passwords, roles as permission sets - Games and versions with content-addressed blob storage; forks copy only the manifest, so mods share assets with the original - Worker: archive/RPA extraction, unrpyc for .rpyc, own .rpy parser, Python subset translated via ast, media converted to WebP/Opus/WebM - React panel (library search, game page, upload, users, roles) and a framework-free web player with saves, history, skip/auto, transitions - docker compose: postgres, backend, worker, nginx on a single HTTP port Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
364b312064
72 files changed
+9707
No files matched your search
@@ -0,0 +1,88 @@
|
||||
"""initial schema
|
||||
|
||||
Revision ID: 0001
|
||||
Revises:
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = "0001"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm")
|
||||
op.create_table(
|
||||
"roles",
|
||||
sa.Column("id", sa.Integer, primary_key=True),
|
||||
sa.Column("name", sa.String(64), nullable=False, unique=True),
|
||||
sa.Column("permissions", postgresql.ARRAY(sa.String), nullable=False),
|
||||
sa.Column("is_system", sa.Boolean, nullable=False),
|
||||
)
|
||||
op.create_table(
|
||||
"users",
|
||||
sa.Column("id", sa.Integer, primary_key=True),
|
||||
sa.Column("username", sa.String(64), nullable=False, unique=True),
|
||||
sa.Column("password_hash", sa.String(255), nullable=False),
|
||||
sa.Column("role_id", sa.Integer, sa.ForeignKey("roles.id"), nullable=False),
|
||||
sa.Column("is_active", sa.Boolean, nullable=False),
|
||||
sa.Column("must_change_password", sa.Boolean, nullable=False),
|
||||
sa.Column("must_change_username", sa.Boolean, nullable=False),
|
||||
sa.Column("token_version", sa.Integer, nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now(),
|
||||
nullable=False),
|
||||
)
|
||||
op.create_table(
|
||||
"games",
|
||||
sa.Column("id", sa.Integer, primary_key=True),
|
||||
sa.Column("title", sa.String(255), nullable=False),
|
||||
sa.Column("description", sa.Text, nullable=False),
|
||||
sa.Column("tags", postgresql.ARRAY(sa.String), nullable=False),
|
||||
sa.Column("engine", sa.String(32), nullable=False),
|
||||
sa.Column("cover_hash", sa.String(80)),
|
||||
sa.Column("created_by_id", sa.Integer, sa.ForeignKey("users.id", ondelete="SET NULL")),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now(),
|
||||
nullable=False),
|
||||
)
|
||||
op.execute("CREATE INDEX ix_games_title_trgm ON games USING gin (title gin_trgm_ops)")
|
||||
op.create_table(
|
||||
"game_versions",
|
||||
sa.Column("id", sa.Integer, primary_key=True),
|
||||
sa.Column("game_id", sa.Integer, sa.ForeignKey("games.id", ondelete="CASCADE"),
|
||||
nullable=False, index=True),
|
||||
sa.Column("parent_id", sa.Integer,
|
||||
sa.ForeignKey("game_versions.id", ondelete="SET NULL")),
|
||||
sa.Column("owner_id", sa.Integer, sa.ForeignKey("users.id", ondelete="SET NULL")),
|
||||
sa.Column("name", sa.String(255), nullable=False),
|
||||
sa.Column("description", sa.Text, nullable=False),
|
||||
sa.Column("status", sa.String(16), nullable=False, index=True),
|
||||
sa.Column("progress", sa.String(255), nullable=False),
|
||||
sa.Column("upload_name", sa.String(255)),
|
||||
sa.Column("manifest", postgresql.JSONB),
|
||||
sa.Column("report", postgresql.JSONB),
|
||||
sa.Column("size_bytes", sa.BigInteger, nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now(),
|
||||
nullable=False),
|
||||
)
|
||||
op.create_table(
|
||||
"saves",
|
||||
sa.Column("id", sa.Integer, primary_key=True),
|
||||
sa.Column("user_id", sa.Integer, sa.ForeignKey("users.id", ondelete="CASCADE"),
|
||||
nullable=False),
|
||||
sa.Column("version_id", sa.Integer,
|
||||
sa.ForeignKey("game_versions.id", ondelete="CASCADE"), nullable=False),
|
||||
sa.Column("slot", sa.String(32), nullable=False),
|
||||
sa.Column("title", sa.String(255), nullable=False),
|
||||
sa.Column("data", postgresql.JSONB, nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now(),
|
||||
nullable=False),
|
||||
sa.UniqueConstraint("user_id", "version_id", "slot"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
for table in ("saves", "game_versions", "games", "users", "roles"):
|
||||
op.drop_table(table)
|
||||
Reference in new issue
Block a user