d6a156dcd2
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>
30 lines
809 B
Python
30 lines
809 B
Python
"""Smoke test — every model imports cleanly and shares the same metadata."""
|
|
|
|
from backend.app.models import (
|
|
Artist,
|
|
Base,
|
|
ImageRecord,
|
|
)
|
|
|
|
|
|
def test_all_models_use_shared_metadata():
|
|
expected_tables = {
|
|
"artist",
|
|
"source",
|
|
"credential",
|
|
"post",
|
|
"image_record",
|
|
"image_provenance",
|
|
"tag",
|
|
"image_tag",
|
|
"download_event",
|
|
}
|
|
assert expected_tables.issubset(Base.metadata.tables.keys())
|
|
|
|
|
|
def test_artist_has_subscription_flag():
|
|
# Sanity: the unified data model decision (Subscription IS Artist) shows up
|
|
# as a boolean flag on Artist, per spec §3.
|
|
assert "is_subscription" in {c.name for c in Artist.__table__.columns}
|
|
assert "primary_post_id" in {c.name for c in ImageRecord.__table__.columns}
|