Invitations: token shown once, only its hash stored, 7-day expiry, the accepting account's email must match. Enrolment codes: 15 minutes, single use, hashed; POST /auth/enrol returns the farm's existing gateway token without rotating it and is rate-limited per IP. No email is sent; the inviter shares the link. Migration 0007, unit tests and scripts/e2e-onboarding.sh.
1058 lines
26 KiB
JSON
1058 lines
26 KiB
JSON
{
|
|
"id": "8c145e60-4c5d-4603-ba85-148c84b48e8b",
|
|
"prevId": "97bbd615-092b-4859-9b89-de9c6295a4f9",
|
|
"version": "7",
|
|
"dialect": "postgresql",
|
|
"tables": {
|
|
"public.org_members": {
|
|
"name": "org_members",
|
|
"schema": "",
|
|
"columns": {
|
|
"org_id": {
|
|
"name": "org_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"role": {
|
|
"name": "role",
|
|
"type": "org_role",
|
|
"typeSchema": "public",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "'viewer'"
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"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": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"org_members_user_id_idx": {
|
|
"name": "org_members_user_id_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "user_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"org_members_org_id_organisations_id_fk": {
|
|
"name": "org_members_org_id_organisations_id_fk",
|
|
"tableFrom": "org_members",
|
|
"tableTo": "organisations",
|
|
"columnsFrom": [
|
|
"org_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"org_members_org_id_user_id_pk": {
|
|
"name": "org_members_org_id_user_id_pk",
|
|
"columns": [
|
|
"org_id",
|
|
"user_id"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {}
|
|
},
|
|
"public.organisations": {
|
|
"name": "organisations",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"settings": {
|
|
"name": "settings",
|
|
"type": "jsonb",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"default": "'{}'::jsonb"
|
|
},
|
|
"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": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {}
|
|
},
|
|
"public.farms": {
|
|
"name": "farms",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"org_id": {
|
|
"name": "org_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"edge_proxy_token": {
|
|
"name": "edge_proxy_token",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"location": {
|
|
"name": "location",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"settings": {
|
|
"name": "settings",
|
|
"type": "jsonb",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"default": "'{}'::jsonb"
|
|
},
|
|
"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": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"farms_org_id_idx": {
|
|
"name": "farms_org_id_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "org_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"farms_org_id_organisations_id_fk": {
|
|
"name": "farms_org_id_organisations_id_fk",
|
|
"tableFrom": "farms",
|
|
"tableTo": "organisations",
|
|
"columnsFrom": [
|
|
"org_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {}
|
|
},
|
|
"public.printers": {
|
|
"name": "printers",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"farm_id": {
|
|
"name": "farm_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"vendor": {
|
|
"name": "vendor",
|
|
"type": "printer_vendor",
|
|
"typeSchema": "public",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"status": {
|
|
"name": "status",
|
|
"type": "printer_status",
|
|
"typeSchema": "public",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "'offline'"
|
|
},
|
|
"lan_address": {
|
|
"name": "lan_address",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"serial_number": {
|
|
"name": "serial_number",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"gateway_printer_id": {
|
|
"name": "gateway_printer_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"nozzle_temp_c": {
|
|
"name": "nozzle_temp_c",
|
|
"type": "real",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"nozzle_target_temp_c": {
|
|
"name": "nozzle_target_temp_c",
|
|
"type": "real",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"bed_temp_c": {
|
|
"name": "bed_temp_c",
|
|
"type": "real",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"bed_target_temp_c": {
|
|
"name": "bed_target_temp_c",
|
|
"type": "real",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"progress_percent": {
|
|
"name": "progress_percent",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"current_layer": {
|
|
"name": "current_layer",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"total_layers": {
|
|
"name": "total_layers",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"remaining_minutes": {
|
|
"name": "remaining_minutes",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"current_job_name": {
|
|
"name": "current_job_name",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"active_alerts": {
|
|
"name": "active_alerts",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"camera_stream": {
|
|
"name": "camera_stream",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"camera_snapshot": {
|
|
"name": "camera_snapshot",
|
|
"type": "boolean",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": false
|
|
},
|
|
"vendor_state": {
|
|
"name": "vendor_state",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"vendor_error_code": {
|
|
"name": "vendor_error_code",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"metadata": {
|
|
"name": "metadata",
|
|
"type": "jsonb",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"default": "'{}'::jsonb"
|
|
},
|
|
"last_seen_at": {
|
|
"name": "last_seen_at",
|
|
"type": "timestamp with time zone",
|
|
"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": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"printers_farm_gateway_printer_id_idx": {
|
|
"name": "printers_farm_gateway_printer_id_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "farm_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
},
|
|
{
|
|
"expression": "gateway_printer_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": true,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"printers_farm_id_farms_id_fk": {
|
|
"name": "printers_farm_id_farms_id_fk",
|
|
"tableFrom": "printers",
|
|
"tableTo": "farms",
|
|
"columnsFrom": [
|
|
"farm_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {}
|
|
},
|
|
"public.print_jobs": {
|
|
"name": "print_jobs",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"farm_id": {
|
|
"name": "farm_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"printer_id": {
|
|
"name": "printer_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"file_name": {
|
|
"name": "file_name",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"r2_object_key": {
|
|
"name": "r2_object_key",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"status": {
|
|
"name": "status",
|
|
"type": "print_job_status",
|
|
"typeSchema": "public",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "'queued'"
|
|
},
|
|
"progress_pct": {
|
|
"name": "progress_pct",
|
|
"type": "real",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": 0
|
|
},
|
|
"estimated_time_s": {
|
|
"name": "estimated_time_s",
|
|
"type": "real",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"elapsed_time_s": {
|
|
"name": "elapsed_time_s",
|
|
"type": "real",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"submitted_by": {
|
|
"name": "submitted_by",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"metadata": {
|
|
"name": "metadata",
|
|
"type": "jsonb",
|
|
"primaryKey": false,
|
|
"notNull": false,
|
|
"default": "'{}'::jsonb"
|
|
},
|
|
"started_at": {
|
|
"name": "started_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"completed_at": {
|
|
"name": "completed_at",
|
|
"type": "timestamp with time zone",
|
|
"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": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"print_jobs_farm_id_farms_id_fk": {
|
|
"name": "print_jobs_farm_id_farms_id_fk",
|
|
"tableFrom": "print_jobs",
|
|
"tableTo": "farms",
|
|
"columnsFrom": [
|
|
"farm_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"print_jobs_printer_id_printers_id_fk": {
|
|
"name": "print_jobs_printer_id_printers_id_fk",
|
|
"tableFrom": "print_jobs",
|
|
"tableTo": "printers",
|
|
"columnsFrom": [
|
|
"printer_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "set null",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {}
|
|
},
|
|
"public.frame_embeddings": {
|
|
"name": "frame_embeddings",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"print_job_id": {
|
|
"name": "print_job_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"printer_id": {
|
|
"name": "printer_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"r2_object_key": {
|
|
"name": "r2_object_key",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"embedding": {
|
|
"name": "embedding",
|
|
"type": "vector(512)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"captured_at": {
|
|
"name": "captured_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"frame_embeddings_embedding_ivfflat_idx": {
|
|
"name": "frame_embeddings_embedding_ivfflat_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "embedding",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last",
|
|
"opclass": "vector_cosine_ops"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "ivfflat",
|
|
"with": {
|
|
"lists": 100
|
|
}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"frame_embeddings_print_job_id_print_jobs_id_fk": {
|
|
"name": "frame_embeddings_print_job_id_print_jobs_id_fk",
|
|
"tableFrom": "frame_embeddings",
|
|
"tableTo": "print_jobs",
|
|
"columnsFrom": [
|
|
"print_job_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"frame_embeddings_printer_id_printers_id_fk": {
|
|
"name": "frame_embeddings_printer_id_printers_id_fk",
|
|
"tableFrom": "frame_embeddings",
|
|
"tableTo": "printers",
|
|
"columnsFrom": [
|
|
"printer_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {}
|
|
},
|
|
"public.printer_alerts": {
|
|
"name": "printer_alerts",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"farm_id": {
|
|
"name": "farm_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"printer_id": {
|
|
"name": "printer_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"kind": {
|
|
"name": "kind",
|
|
"type": "alert_kind",
|
|
"typeSchema": "public",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"message": {
|
|
"name": "message",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"confidence": {
|
|
"name": "confidence",
|
|
"type": "real",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"object_key": {
|
|
"name": "object_key",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"acknowledged_by": {
|
|
"name": "acknowledged_by",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"acknowledged_at": {
|
|
"name": "acknowledged_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"printer_alerts_farm_open_idx": {
|
|
"name": "printer_alerts_farm_open_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "farm_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
},
|
|
{
|
|
"expression": "acknowledged_at",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"printer_alerts_farm_id_farms_id_fk": {
|
|
"name": "printer_alerts_farm_id_farms_id_fk",
|
|
"tableFrom": "printer_alerts",
|
|
"tableTo": "farms",
|
|
"columnsFrom": [
|
|
"farm_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"printer_alerts_printer_id_printers_id_fk": {
|
|
"name": "printer_alerts_printer_id_printers_id_fk",
|
|
"tableFrom": "printer_alerts",
|
|
"tableTo": "printers",
|
|
"columnsFrom": [
|
|
"printer_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "set null",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {}
|
|
},
|
|
"public.enrolment_codes": {
|
|
"name": "enrolment_codes",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"farm_id": {
|
|
"name": "farm_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"code_hash": {
|
|
"name": "code_hash",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"created_by": {
|
|
"name": "created_by",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"expires_at": {
|
|
"name": "expires_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"used_at": {
|
|
"name": "used_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
}
|
|
},
|
|
"indexes": {
|
|
"enrolment_codes_farm_idx": {
|
|
"name": "enrolment_codes_farm_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "farm_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"enrolment_codes_farm_id_farms_id_fk": {
|
|
"name": "enrolment_codes_farm_id_farms_id_fk",
|
|
"tableFrom": "enrolment_codes",
|
|
"tableTo": "farms",
|
|
"columnsFrom": [
|
|
"farm_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"enrolment_codes_code_hash_unique": {
|
|
"name": "enrolment_codes_code_hash_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"code_hash"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"public.org_invitations": {
|
|
"name": "org_invitations",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"org_id": {
|
|
"name": "org_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"role": {
|
|
"name": "role",
|
|
"type": "org_role",
|
|
"typeSchema": "public",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"token_hash": {
|
|
"name": "token_hash",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"invited_by": {
|
|
"name": "invited_by",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"expires_at": {
|
|
"name": "expires_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"accepted_at": {
|
|
"name": "accepted_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"accepted_by": {
|
|
"name": "accepted_by",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
}
|
|
},
|
|
"indexes": {
|
|
"org_invitations_org_idx": {
|
|
"name": "org_invitations_org_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "org_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"org_invitations_org_id_organisations_id_fk": {
|
|
"name": "org_invitations_org_id_organisations_id_fk",
|
|
"tableFrom": "org_invitations",
|
|
"tableTo": "organisations",
|
|
"columnsFrom": [
|
|
"org_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"org_invitations_token_hash_unique": {
|
|
"name": "org_invitations_token_hash_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"token_hash"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"enums": {
|
|
"public.org_role": {
|
|
"name": "org_role",
|
|
"schema": "public",
|
|
"values": [
|
|
"viewer",
|
|
"operator",
|
|
"owner"
|
|
]
|
|
},
|
|
"public.printer_status": {
|
|
"name": "printer_status",
|
|
"schema": "public",
|
|
"values": [
|
|
"offline",
|
|
"idle",
|
|
"printing",
|
|
"paused",
|
|
"error",
|
|
"maintenance"
|
|
]
|
|
},
|
|
"public.printer_vendor": {
|
|
"name": "printer_vendor",
|
|
"schema": "public",
|
|
"values": [
|
|
"bambu",
|
|
"prusa",
|
|
"klipper",
|
|
"octoprint"
|
|
]
|
|
},
|
|
"public.print_job_status": {
|
|
"name": "print_job_status",
|
|
"schema": "public",
|
|
"values": [
|
|
"queued",
|
|
"uploading",
|
|
"printing",
|
|
"paused",
|
|
"completed",
|
|
"failed",
|
|
"cancelled"
|
|
]
|
|
},
|
|
"public.alert_kind": {
|
|
"name": "alert_kind",
|
|
"schema": "public",
|
|
"values": [
|
|
"print_failed",
|
|
"print_paused",
|
|
"printer_error",
|
|
"ai_detection"
|
|
]
|
|
}
|
|
},
|
|
"schemas": {},
|
|
"sequences": {},
|
|
"_meta": {
|
|
"columns": {},
|
|
"schemas": {},
|
|
"tables": {}
|
|
}
|
|
} |