feat: define unified schema (Artist, Source, Post, ImageRecord, etc.) and initial migration

Implements the data model from spec §3 in one go so FC-2/FC-3 don't need
schema-adding migrations of their own. Artist is the unified entity for
both gallery 'artist:' tags and GallerySubscriber Subscriptions
(is_subscription flag). ImageProvenance is many-to-one, enabling the
enrich-on-duplicate rule for downloaded content that pHash-matches an
existing record.

The SigLIP embedding column uses pgvector(1152) for SigLIP-so400m;
swapping models in FC-2 will require a column-width migration.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-14 07:34:29 -04:00
parent a03655039c
commit d6a156dcd2
11 changed files with 619 additions and 3 deletions
+20 -3
View File
@@ -1,7 +1,24 @@
"""All ORM models. Import this module to make every model visible to Alembic."""
from .artist import Artist
from .base import Base
from .credential import Credential
from .download_event import DownloadEvent
from .image_provenance import ImageProvenance
from .image_record import ImageRecord
from .post import Post
from .source import Source
from .tag import Tag, image_tag
# Concrete models land in Task 6 and re-export here.
__all__ = ["Base"]
__all__ = [
"Base",
"Artist",
"Source",
"Credential",
"Post",
"ImageRecord",
"ImageProvenance",
"Tag",
"image_tag",
"DownloadEvent",
]