Files
glenloch-media/drizzle/meta/0004_snapshot.json
Tiel Coder 5c789f63cc B4 — Positions + skills + requirements editor
Positions (schedulable seats) CRUD + requirements editor. Governing rule:
a position with no is_core skill refuses to save as publishable.
Schema (src/db/schema.ts):
- skills table (B4 prerequisite of position_skills): id, slug (unique),
  name, category_id/technology_id/function_id FKs, dedupe_key
  (category|technology|function, NULLs -> ''), mentor_min_level (default
  'expert'), stale_after_days (default 120), recert_required, sort_order,
  active, created_at, updated_at. All FKs ON DELETE RESTRICT.
- position_skills join: position_id, skill_id, weight, required_level,
  is_core; PK (position_id, skill_id).
- roles (positions) gained active (default true) + updated_at for
  soft-delete/pickers/audit.
Data layer (src/db/positions.ts): list/create/update/deactivate for
positions and skills; getPositionSkills (skills merged into
position_skills in JS); setPositionSkills (replaces the whole set);
dedupeKey() helper.
Domain (src/domain/positions.ts + .test.ts): pure publishability rule —
isPublishable(skills) = has >=1 is_core skill. 8 tests named after the
rule.
API:
- src/app/api/dev/skills/route.ts — GET/POST/PATCH (slug + dedupe_key
  generated at create; slug frozen on update).
- src/app/api/dev/positions/route.ts — GET/POST/PATCH (rename/edit or
  deactivate via active:false).
- src/app/api/dev/positions/requirements/route.ts — GET (list a
  position's requirements) + POST (set requirements; enforces the
  publishability gate: published:true with no core skill -> 400).
Migration drizzle/0004_hesitant_ezekiel.sql.
Verification: typecheck ✓ lint ✓ test ✓ (44, +8) build ✓ db:migrate ✓;
runtime smoke /tmp/b4.sh (24 checks) — publish-with-core 200,
publish-without-core 400, weight-out-of-range 400, rename slug frozen,
deactivate hides from picker but row persists.
Decisions: skills table is a B4 prerequisite; requirements editor takes
positionId in the body (Next 15.5.29 rejects an explicitly-typed
{ params: { id } } route-handler second arg); publishability gate lives
in the domain and is enforced in the route; join resolved in JS
(drizzle 0.45.4 exports no join).
2026-11-18 01:34:24 +00:00

1853 lines
47 KiB
JSON

{
"id": "1cf0c37b-ed49-4013-bb63-783aae4616aa",
"prevId": "e5b56f4b-4851-4557-8013-15eb1ce13701",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.assignments": {
"name": "assignments",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"slot_id": {
"name": "slot_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'proposed'"
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'manual'"
},
"assigned_by": {
"name": "assigned_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"assigned_at": {
"name": "assigned_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"responded_at": {
"name": "responded_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"decline_reason": {
"name": "decline_reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"confirmed_via": {
"name": "confirmed_via",
"type": "text",
"primaryKey": false,
"notNull": false
},
"reminder_count": {
"name": "reminder_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {
"uq_active_assignment": {
"name": "uq_active_assignment",
"columns": [
{
"expression": "slot_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"where": "\"assignments\".\"status\" IN ('proposed','confirmed','completed')",
"concurrently": false,
"method": "btree",
"with": {}
},
"assignments_user_idx": {
"name": "assignments_user_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"assignments_slot_id_slots_id_fk": {
"name": "assignments_slot_id_slots_id_fk",
"tableFrom": "assignments",
"tableTo": "slots",
"columnsFrom": [
"slot_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"assignments_user_id_users_id_fk": {
"name": "assignments_user_id_users_id_fk",
"tableFrom": "assignments",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.functions": {
"name": "functions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"slug": {
"name": "slug",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"category_id": {
"name": "category_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"active": {
"name": "active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"functions_slug_idx": {
"name": "functions_slug_idx",
"columns": [
{
"expression": "slug",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"functions_active_idx": {
"name": "functions_active_idx",
"columns": [
{
"expression": "active",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"functions_category_idx": {
"name": "functions_category_idx",
"columns": [
{
"expression": "category_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"functions_category_id_skill_categories_id_fk": {
"name": "functions_category_id_skill_categories_id_fk",
"tableFrom": "functions",
"tableTo": "skill_categories",
"columnsFrom": [
"category_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"functions_slug_unique": {
"name": "functions_slug_unique",
"nullsNotDistinct": false,
"columns": [
"slug"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.notification_preferences": {
"name": "notification_preferences",
"schema": "",
"columns": {
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"email_enabled": {
"name": "email_enabled",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"sms_enabled": {
"name": "sms_enabled",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"sms_consent_at": {
"name": "sms_consent_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"sms_consent_source": {
"name": "sms_consent_source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"sms_consent_ip": {
"name": "sms_consent_ip",
"type": "text",
"primaryKey": false,
"notNull": false
},
"reminder_lead_days": {
"name": "reminder_lead_days",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 7
},
"quiet_hours_start": {
"name": "quiet_hours_start",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'21:00'"
},
"quiet_hours_end": {
"name": "quiet_hours_end",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'08:00'"
},
"digest_only": {
"name": "digest_only",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
}
},
"indexes": {},
"foreignKeys": {
"notification_preferences_user_id_users_id_fk": {
"name": "notification_preferences_user_id_users_id_fk",
"tableFrom": "notification_preferences",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.position_skills": {
"name": "position_skills",
"schema": "",
"columns": {
"position_id": {
"name": "position_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"skill_id": {
"name": "skill_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"weight": {
"name": "weight",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 1
},
"required_level": {
"name": "required_level",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_core": {
"name": "is_core",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
}
},
"indexes": {
"position_skills_skill_idx": {
"name": "position_skills_skill_idx",
"columns": [
{
"expression": "skill_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"position_skills_position_id_roles_id_fk": {
"name": "position_skills_position_id_roles_id_fk",
"tableFrom": "position_skills",
"tableTo": "roles",
"columnsFrom": [
"position_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
},
"position_skills_skill_id_skills_id_fk": {
"name": "position_skills_skill_id_skills_id_fk",
"tableFrom": "position_skills",
"tableTo": "skills",
"columnsFrom": [
"skill_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"position_skills_pk": {
"name": "position_skills_pk",
"columns": [
"position_id",
"skill_id"
]
}
},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.roles": {
"name": "roles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"slug": {
"name": "slug",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"color_hex": {
"name": "color_hex",
"type": "text",
"primaryKey": false,
"notNull": false
},
"call_time_offset_minutes": {
"name": "call_time_offset_minutes",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"requires_certification": {
"name": "requires_certification",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"default_headcount": {
"name": "default_headcount",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 1
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"active": {
"name": "active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"roles_slug_idx": {
"name": "roles_slug_idx",
"columns": [
{
"expression": "slug",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"roles_active_idx": {
"name": "roles_active_idx",
"columns": [
{
"expression": "active",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"roles_slug_unique": {
"name": "roles_slug_unique",
"nullsNotDistinct": false,
"columns": [
"slug"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.service_instances": {
"name": "service_instances",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"service_id": {
"name": "service_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"occurs_on": {
"name": "occurs_on",
"type": "date",
"primaryKey": false,
"notNull": false
},
"starts_at": {
"name": "starts_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"ends_at": {
"name": "ends_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"is_special": {
"name": "is_special",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"title_override": {
"name": "title_override",
"type": "text",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'draft'"
},
"published_at": {
"name": "published_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"published_by": {
"name": "published_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"si_service_starts_at_idx": {
"name": "si_service_starts_at_idx",
"columns": [
{
"expression": "service_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "starts_at",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"si_occurs_on_idx": {
"name": "si_occurs_on_idx",
"columns": [
{
"expression": "occurs_on",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"si_status_idx": {
"name": "si_status_idx",
"columns": [
{
"expression": "status",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"service_instances_service_id_services_id_fk": {
"name": "service_instances_service_id_services_id_fk",
"tableFrom": "service_instances",
"tableTo": "services",
"columnsFrom": [
"service_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.services": {
"name": "services",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"location": {
"name": "location",
"type": "text",
"primaryKey": false,
"notNull": false
},
"timezone": {
"name": "timezone",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'America/New_York'"
},
"rrule": {
"name": "rrule",
"type": "text",
"primaryKey": false,
"notNull": false
},
"start_time_local": {
"name": "start_time_local",
"type": "text",
"primaryKey": false,
"notNull": true
},
"duration_minutes": {
"name": "duration_minutes",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 75
},
"doors_open_minutes_before": {
"name": "doors_open_minutes_before",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"active": {
"name": "active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"services_active_idx": {
"name": "services_active_idx",
"columns": [
{
"expression": "active",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"services_name_unique": {
"name": "services_name_unique",
"nullsNotDistinct": false,
"columns": [
"name"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.skill_categories": {
"name": "skill_categories",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"slug": {
"name": "slug",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"color_hex": {
"name": "color_hex",
"type": "text",
"primaryKey": false,
"notNull": false
},
"icon": {
"name": "icon",
"type": "text",
"primaryKey": false,
"notNull": false
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"active": {
"name": "active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"skill_categories_slug_idx": {
"name": "skill_categories_slug_idx",
"columns": [
{
"expression": "slug",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"skill_categories_active_idx": {
"name": "skill_categories_active_idx",
"columns": [
{
"expression": "active",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"skill_categories_slug_unique": {
"name": "skill_categories_slug_unique",
"nullsNotDistinct": false,
"columns": [
"slug"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.skills": {
"name": "skills",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"slug": {
"name": "slug",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"category_id": {
"name": "category_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"technology_id": {
"name": "technology_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"function_id": {
"name": "function_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"dedupe_key": {
"name": "dedupe_key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"mentor_min_level": {
"name": "mentor_min_level",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'expert'"
},
"stale_after_days": {
"name": "stale_after_days",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 120
},
"recert_required": {
"name": "recert_required",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"active": {
"name": "active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"skills_slug_idx": {
"name": "skills_slug_idx",
"columns": [
{
"expression": "slug",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"skills_active_idx": {
"name": "skills_active_idx",
"columns": [
{
"expression": "active",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"skills_category_idx": {
"name": "skills_category_idx",
"columns": [
{
"expression": "category_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"skills_category_id_skill_categories_id_fk": {
"name": "skills_category_id_skill_categories_id_fk",
"tableFrom": "skills",
"tableTo": "skill_categories",
"columnsFrom": [
"category_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
},
"skills_technology_id_technologies_id_fk": {
"name": "skills_technology_id_technologies_id_fk",
"tableFrom": "skills",
"tableTo": "technologies",
"columnsFrom": [
"technology_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
},
"skills_function_id_functions_id_fk": {
"name": "skills_function_id_functions_id_fk",
"tableFrom": "skills",
"tableTo": "functions",
"columnsFrom": [
"function_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"skills_slug_unique": {
"name": "skills_slug_unique",
"nullsNotDistinct": false,
"columns": [
"slug"
]
},
"skills_dedupe_key_unique": {
"name": "skills_dedupe_key_unique",
"nullsNotDistinct": false,
"columns": [
"dedupe_key"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.slots": {
"name": "slots",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"service_instance_id": {
"name": "service_instance_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"event_id": {
"name": "event_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"role_id": {
"name": "role_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"slot_index": {
"name": "slot_index",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"call_time": {
"name": "call_time",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'open'"
},
"slot_note": {
"name": "slot_note",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_trainee_slot": {
"name": "is_trainee_slot",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"paired_with_user_id": {
"name": "paired_with_user_id",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"slots_instance_role_idx": {
"name": "slots_instance_role_idx",
"columns": [
{
"expression": "service_instance_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "role_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "slot_index",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"slots_status_idx": {
"name": "slots_status_idx",
"columns": [
{
"expression": "status",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"slots_service_instance_id_service_instances_id_fk": {
"name": "slots_service_instance_id_service_instances_id_fk",
"tableFrom": "slots",
"tableTo": "service_instances",
"columnsFrom": [
"service_instance_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"slots_role_id_roles_id_fk": {
"name": "slots_role_id_roles_id_fk",
"tableFrom": "slots",
"tableTo": "roles",
"columnsFrom": [
"role_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
},
"slots_paired_with_user_id_users_id_fk": {
"name": "slots_paired_with_user_id_users_id_fk",
"tableFrom": "slots",
"tableTo": "users",
"columnsFrom": [
"paired_with_user_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {
"chk_slots_single_parent": {
"name": "chk_slots_single_parent",
"value": "(service_instance_id IS NOT NULL) <> (event_id IS NOT NULL)"
}
},
"isRLSEnabled": false
},
"public.technologies": {
"name": "technologies",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"slug": {
"name": "slug",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"vendor_id": {
"name": "vendor_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"category_id": {
"name": "category_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"model_number": {
"name": "model_number",
"type": "text",
"primaryKey": false,
"notNull": false
},
"version_label": {
"name": "version_label",
"type": "text",
"primaryKey": false,
"notNull": false
},
"docs_url": {
"name": "docs_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"purchased_on": {
"name": "purchased_on",
"type": "date",
"primaryKey": false,
"notNull": false
},
"serial_number": {
"name": "serial_number",
"type": "text",
"primaryKey": false,
"notNull": false
},
"retired_at": {
"name": "retired_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"successor_technology_id": {
"name": "successor_technology_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"active": {
"name": "active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"technologies_slug_idx": {
"name": "technologies_slug_idx",
"columns": [
{
"expression": "slug",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"technologies_active_idx": {
"name": "technologies_active_idx",
"columns": [
{
"expression": "active",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"technologies_vendor_idx": {
"name": "technologies_vendor_idx",
"columns": [
{
"expression": "vendor_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"technologies_category_idx": {
"name": "technologies_category_idx",
"columns": [
{
"expression": "category_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"technologies_vendor_id_vendors_id_fk": {
"name": "technologies_vendor_id_vendors_id_fk",
"tableFrom": "technologies",
"tableTo": "vendors",
"columnsFrom": [
"vendor_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
},
"technologies_category_id_skill_categories_id_fk": {
"name": "technologies_category_id_skill_categories_id_fk",
"tableFrom": "technologies",
"tableTo": "skill_categories",
"columnsFrom": [
"category_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"technologies_slug_unique": {
"name": "technologies_slug_unique",
"nullsNotDistinct": false,
"columns": [
"slug"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"phone_e164": {
"name": "phone_e164",
"type": "text",
"primaryKey": false,
"notNull": false
},
"first_name": {
"name": "first_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"last_name": {
"name": "last_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"system_role": {
"name": "system_role",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'volunteer'"
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'pending_approval'"
},
"avatar_url": {
"name": "avatar_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"timezone": {
"name": "timezone",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'America/New_York'"
},
"emergency_contact": {
"name": "emergency_contact",
"type": "text",
"primaryKey": false,
"notNull": false
},
"approved_by": {
"name": "approved_by",
"type": "text",
"primaryKey": false,
"notNull": false
},
"approved_at": {
"name": "approved_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"last_served_at": {
"name": "last_served_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"reliability_score": {
"name": "reliability_score",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"deactivated_at": {
"name": "deactivated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"users_email_lower_idx": {
"name": "users_email_lower_idx",
"columns": [
{
"expression": "lower(\"email\")",
"asc": true,
"isExpression": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"users_status_idx": {
"name": "users_status_idx",
"columns": [
{
"expression": "status",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"users_system_role_idx": {
"name": "users_system_role_idx",
"columns": [
{
"expression": "system_role",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"users_email_unique": {
"name": "users_email_unique",
"nullsNotDistinct": false,
"columns": [
"email"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.vendors": {
"name": "vendors",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"slug": {
"name": "slug",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"support_url": {
"name": "support_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"support_phone": {
"name": "support_phone",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"active": {
"name": "active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
}
},
"indexes": {
"vendors_slug_idx": {
"name": "vendors_slug_idx",
"columns": [
{
"expression": "slug",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"vendors_active_idx": {
"name": "vendors_active_idx",
"columns": [
{
"expression": "active",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"vendors_slug_unique": {
"name": "vendors_slug_unique",
"nullsNotDistinct": false,
"columns": [
"slug"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}