Table: featured_items
Ce contenu n’est pas encore disponible dans votre langue.
Connected to
Section titled “Connected to”This table references:
teams(id) via columnteam_idpromo_bands(id) via columnband_id
Columns
Section titled “Columns”| Column | Type | Nullable | Notes |
|---|---|---|---|
id | uuid | no | Default gen_random_uuid() |
subject_kind | text | no | What the placement points at: asset, collection or team. There’s no foreign key because the subject can be any of these; reads join the matching table and drop placements whose subject the caller can’t see. Adding a kind means updating every place the list is repeated (this check, the handler’s validation and error text, the OpenAPI input and response enums, and the admin curation list). |
subject_id | uuid | no | - |
position | integer | no | Default 0 |
created_at | timestamp | no | Default now() |
created_by_user_ref | bigint | yes | - |
scope | text | no | Default 'org'::text |
team_id | uuid | yes | References teams(id) |
band_id | uuid | yes | References promo_bands(id). Which surface the placement belongs to: NULL for the featured rail, or a promo band’s id for a card in that band. For band cards, the band’s scope sets the audience and this row’s own scope isn’t used. |
Constraints
Section titled “Constraints”CONSTRAINT featured_items_scope_check CHECK ((scope = ANY (ARRAY['public'::text, 'org'::text, 'team'::text])))CONSTRAINT featured_items_subject_kind_check CHECK ((subject_kind = ANY (ARRAY['asset'::text, 'collection'::text, 'team'::text])))CONSTRAINT featured_items_team_scope_check CHECK ((((scope = 'team'::text) AND (team_id IS NOT NULL)) OR ((scope <> 'team'::text) AND (team_id IS NULL))))
Full DDL
Section titled “Full DDL”This is the table’s CREATE TABLE statement. Constraints added with separate ALTER TABLE statements, including foreign-key ON DELETE rules, and indexes are defined elsewhere in the dump; see the complete app/schema.sql.
CREATE TABLE public.featured_items ( id uuid DEFAULT gen_random_uuid() NOT NULL, subject_kind text NOT NULL, subject_id uuid NOT NULL, "position" integer DEFAULT 0 NOT NULL, created_at timestamp with time zone DEFAULT now() NOT NULL, created_by_user_ref bigint, scope text DEFAULT 'org'::text NOT NULL, team_id uuid, band_id uuid, CONSTRAINT featured_items_scope_check CHECK ((scope = ANY (ARRAY['public'::text, 'org'::text, 'team'::text]))), CONSTRAINT featured_items_subject_kind_check CHECK ((subject_kind = ANY (ARRAY['asset'::text, 'collection'::text, 'team'::text]))), CONSTRAINT featured_items_team_scope_check CHECK ((((scope = 'team'::text) AND (team_id IS NOT NULL)) OR ((scope <> 'team'::text) AND (team_id IS NULL)))));See the schema overview for context.