WIP checkpoint: World discovery metadata + visits model & Alembic migration
This commit is contained in:
@@ -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.orm import relationship
|
||||
from sqlalchemy.sql import func
|
||||
@@ -33,11 +33,11 @@ class World(Base):
|
||||
play_count = Column(Integer, nullable=False, server_default="0")
|
||||
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")
|
||||
assets = relationship("Asset", 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},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user