1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! `MediaTag` — flat, free-form labels on [`Media`] rows.
//!
//! Sibling to [`crate::media::collection::MediaCollection`]: tags
//! express inclusive labels ("featured", "approved",
//! "homepage-hero"); collections express exclusive location.
//! M2M between Media and Tag via [`MediaTagLink`]
//! (`rustango_media_tag_links`).
//!
//! Tags are cheap to recreate, so deletion is hard (not soft) — the
//! junction rows cascade away with the FK.
//!
//! Both models are managed `#[derive(Model)]`s on `rustango_*` tables, so
//! their schema is emitted as ordinary **system migrations** (and, in
//! tests, materialized by [`crate::testkit::migrate_framework`]). There is
//! no lazy `ensure_*` creation layer — the tables exist because migrations
//! ran, exactly like the rest of the framework's own tables.
//!
//! [`Media`]: crate::media::Media
use crateAuto;
/// One free-form label. Cheap to clone.
/// Junction row linking a [`Media`] to a [`MediaTag`] (the M2M table).
///
/// Carries a surrogate `Auto<i64>` PK so it's an ordinary managed model;
/// the logical key is the composite `UNIQUE(media_id, tag_id)`.
/// `MediaManager` raw-inserts only `(media_id, tag_id)` (relying on the
/// unique index for idempotency, never on a returned id), so the surrogate
/// PK is harmless.
///
/// [`Media`]: crate::media::Media