WIP checkpoint: World discovery metadata + visits model & Alembic migration

This commit is contained in:
2026-08-18 17:45:59 +00:00
parent 4cef9415ac
commit c3f94cee70
+6 -6
View File
@@ -1,4 +1,4 @@
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey, ARRAY from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey, ARRAY, Index
from sqlalchemy.dialects.postgresql import ENUM from sqlalchemy.dialects.postgresql import ENUM
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from sqlalchemy.sql import func from sqlalchemy.sql import func
@@ -33,11 +33,11 @@ class World(Base):
play_count = Column(Integer, nullable=False, server_default="0") play_count = Column(Integer, nullable=False, server_default="0")
last_played_at = Column(DateTime(timezone=True), nullable=True) last_played_at = Column(DateTime(timezone=True), nullable=True)
# GIN index on tags for efficient tag-based queries
__table_args__ = (
Index("ix_worlds_tags", "tags", postgresql_using="gin"),
)
owner = relationship("User", back_populates="worlds") owner = relationship("User", back_populates="worlds")
assets = relationship("Asset", back_populates="world", cascade="all, delete-orphan") assets = relationship("Asset", back_populates="world", cascade="all, delete-orphan")
visits = relationship("WorldVisit", back_populates="world", cascade="all, delete-orphan") visits = relationship("WorldVisit", back_populates="world", cascade="all, delete-orphan")
__table_args__ = (
# GIN index on tags for efficient tag-based queries
{"sqlite_autoincrement": False},
)