{ "version": "6", "dialect": "sqlite", "id": "af63046b-f0dc-4603-a2ba-ba840c09a8f4", "prevId": "edf19f43-5474-41ee-9fb2-c05f24c10559", "tables": { "account": { "name": "account", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "account_id": { "name": "account_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "provider_id": { "name": "provider_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "user_id": { "name": "user_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "access_token": { "name": "access_token", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "refresh_token": { "name": "refresh_token", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "id_token": { "name": "id_token", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "access_token_expires_at": { "name": "access_token_expires_at", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false }, "refresh_token_expires_at": { "name": "refresh_token_expires_at", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false }, "scope": { "name": "scope", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "password": { "name": "password", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "account_userId_idx": { "name": "account_userId_idx", "columns": [ "user_id" ], "isUnique": false } }, "foreignKeys": { "account_user_id_user_id_fk": { "name": "account_user_id_user_id_fk", "tableFrom": "account", "tableTo": "user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "invitation": { "name": "invitation", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "role": { "name": "role", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'pending'" }, "expires_at": { "name": "expires_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" }, "inviter_id": { "name": "inviter_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "invitation_organizationId_idx": { "name": "invitation_organizationId_idx", "columns": [ "organization_id" ], "isUnique": false }, "invitation_email_idx": { "name": "invitation_email_idx", "columns": [ "email" ], "isUnique": false } }, "foreignKeys": { "invitation_organization_id_organization_id_fk": { "name": "invitation_organization_id_organization_id_fk", "tableFrom": "invitation", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "invitation_inviter_id_user_id_fk": { "name": "invitation_inviter_id_user_id_fk", "tableFrom": "invitation", "tableTo": "user", "columnsFrom": [ "inviter_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "member": { "name": "member", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "user_id": { "name": "user_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "role": { "name": "role", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'member'" }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "member_organizationId_idx": { "name": "member_organizationId_idx", "columns": [ "organization_id" ], "isUnique": false }, "member_userId_idx": { "name": "member_userId_idx", "columns": [ "user_id" ], "isUnique": false } }, "foreignKeys": { "member_organization_id_organization_id_fk": { "name": "member_organization_id_organization_id_fk", "tableFrom": "member", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "member_user_id_user_id_fk": { "name": "member_user_id_user_id_fk", "tableFrom": "member", "tableTo": "user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "organization": { "name": "organization", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "slug": { "name": "slug", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "logo": { "name": "logo", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "metadata": { "name": "metadata", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": { "organization_slug_unique": { "name": "organization_slug_unique", "columns": [ "slug" ], "isUnique": true } }, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "session": { "name": "session", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "expires_at": { "name": "expires_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "token": { "name": "token", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "ip_address": { "name": "ip_address", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "user_agent": { "name": "user_agent", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "user_id": { "name": "user_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "active_organization_id": { "name": "active_organization_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": { "session_token_unique": { "name": "session_token_unique", "columns": [ "token" ], "isUnique": true }, "session_userId_idx": { "name": "session_userId_idx", "columns": [ "user_id" ], "isUnique": false } }, "foreignKeys": { "session_user_id_user_id_fk": { "name": "session_user_id_user_id_fk", "tableFrom": "session", "tableTo": "user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "two_factor": { "name": "two_factor", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "secret": { "name": "secret", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "backup_codes": { "name": "backup_codes", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "user_id": { "name": "user_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "verified": { "name": "verified", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false, "default": true }, "failed_verification_count": { "name": "failed_verification_count", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false, "default": 0 }, "locked_until": { "name": "locked_until", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": { "twoFactor_secret_idx": { "name": "twoFactor_secret_idx", "columns": [ "secret" ], "isUnique": false }, "twoFactor_userId_idx": { "name": "twoFactor_userId_idx", "columns": [ "user_id" ], "isUnique": false } }, "foreignKeys": { "two_factor_user_id_user_id_fk": { "name": "two_factor_user_id_user_id_fk", "tableFrom": "two_factor", "tableTo": "user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "user": { "name": "user", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "email_verified": { "name": "email_verified", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "image": { "name": "image", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" }, "username": { "name": "username", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "display_username": { "name": "display_username", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "two_factor_enabled": { "name": "two_factor_enabled", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false, "default": false }, "first_name": { "name": "first_name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "last_name": { "name": "last_name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "user_email_unique": { "name": "user_email_unique", "columns": [ "email" ], "isUnique": true }, "user_username_unique": { "name": "user_username_unique", "columns": [ "username" ], "isUnique": true } }, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "verification": { "name": "verification", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "identifier": { "name": "identifier", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "value": { "name": "value", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "expires_at": { "name": "expires_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" } }, "indexes": { "verification_identifier_idx": { "name": "verification_identifier_idx", "columns": [ "identifier" ], "isUnique": false } }, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "attendance_daily_summary": { "name": "attendance_daily_summary", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "attendance_date": { "name": "attendance_date", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "checked_in_count": { "name": "checked_in_count", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "checked_out_count": { "name": "checked_out_count", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "present_count": { "name": "present_count", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "late_count": { "name": "late_count", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "absent_count": { "name": "absent_count", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "peak_occupancy": { "name": "peak_occupancy", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" } }, "indexes": { "attendance_daily_summary_org_date_uidx": { "name": "attendance_daily_summary_org_date_uidx", "columns": [ "organization_id", "attendance_date" ], "isUnique": true } }, "foreignKeys": { "attendance_daily_summary_organization_id_organization_id_fk": { "name": "attendance_daily_summary_organization_id_organization_id_fk", "tableFrom": "attendance_daily_summary", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "attendance_event": { "name": "attendance_event", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "member_id": { "name": "member_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "camera_id": { "name": "camera_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "direction": { "name": "direction", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "captured_at": { "name": "captured_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "method": { "name": "method", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "confidence": { "name": "confidence", "type": "real", "primaryKey": false, "notNull": false, "autoincrement": false }, "notes": { "name": "notes", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_by_user_id": { "name": "created_by_user_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" } }, "indexes": { "attendance_event_org_captured_idx": { "name": "attendance_event_org_captured_idx", "columns": [ "organization_id", "captured_at" ], "isUnique": false }, "attendance_event_member_captured_idx": { "name": "attendance_event_member_captured_idx", "columns": [ "member_id", "captured_at" ], "isUnique": false }, "attendance_event_camera_captured_idx": { "name": "attendance_event_camera_captured_idx", "columns": [ "camera_id", "captured_at" ], "isUnique": false } }, "foreignKeys": { "attendance_event_organization_id_organization_id_fk": { "name": "attendance_event_organization_id_organization_id_fk", "tableFrom": "attendance_event", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "attendance_event_member_id_attendance_member_id_fk": { "name": "attendance_event_member_id_attendance_member_id_fk", "tableFrom": "attendance_event", "tableTo": "attendance_member", "columnsFrom": [ "member_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "attendance_event_camera_id_camera_id_fk": { "name": "attendance_event_camera_id_camera_id_fk", "tableFrom": "attendance_event", "tableTo": "camera", "columnsFrom": [ "camera_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "attendance_event_created_by_user_id_user_id_fk": { "name": "attendance_event_created_by_user_id_user_id_fk", "tableFrom": "attendance_event", "tableTo": "user", "columnsFrom": [ "created_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "attendance_member": { "name": "attendance_member", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "member_code": { "name": "member_code", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "first_name": { "name": "first_name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "last_name": { "name": "last_name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "phone": { "name": "phone", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "department": { "name": "department", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "photo_url": { "name": "photo_url", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'active'" }, "registered_at": { "name": "registered_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" } }, "indexes": { "attendance_member_org_code_uidx": { "name": "attendance_member_org_code_uidx", "columns": [ "organization_id", "member_code" ], "isUnique": true }, "attendance_member_org_email_uidx": { "name": "attendance_member_org_email_uidx", "columns": [ "organization_id", "email" ], "isUnique": true }, "attendance_member_org_status_idx": { "name": "attendance_member_org_status_idx", "columns": [ "organization_id", "status" ], "isUnique": false } }, "foreignKeys": { "attendance_member_organization_id_organization_id_fk": { "name": "attendance_member_organization_id_organization_id_fk", "tableFrom": "attendance_member", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "camera": { "name": "camera", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "organization_id": { "name": "organization_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "location": { "name": "location", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "zone": { "name": "zone", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "stream_url": { "name": "stream_url", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'offline'" }, "last_seen_at": { "name": "last_seen_at", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(cast(unixepoch('subsecond') * 1000 as integer))" } }, "indexes": { "camera_org_name_uidx": { "name": "camera_org_name_uidx", "columns": [ "organization_id", "name" ], "isUnique": true }, "camera_org_status_idx": { "name": "camera_org_status_idx", "columns": [ "organization_id", "status" ], "isUnique": false } }, "foreignKeys": { "camera_organization_id_organization_id_fk": { "name": "camera_organization_id_organization_id_fk", "tableFrom": "camera", "tableTo": "organization", "columnsFrom": [ "organization_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} } }, "views": {}, "enums": {}, "_meta": { "schemas": {}, "tables": {}, "columns": {} }, "internal": { "indexes": {} } }