{ "namespaces": [ "public" ], "name": "public", "tables": [ { "columns": { "id": { "name": "id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "default": "gen_random_uuid()", "mappedType": "uuid" }, "resource_kind": { "name": "resource_kind", "type": "text", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "mappedType": "text" }, "resource_id": { "name": "resource_id", "type": "text", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "mappedType": "text" }, "token": { "name": "token", "type": "text", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "mappedType": "text" }, "strategy": { "name": "strategy", "type": "text", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "default": "'optimistic'", "mappedType": "text" }, "status": { "name": "status", "type": "text", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "default": "'active'", "mappedType": "text" }, "locked_by_user_id": { "name": "locked_by_user_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "mappedType": "uuid" }, "locked_by_ip": { "name": "locked_by_ip", "type": "text", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "mappedType": "text" }, "base_action_log_id": { "name": "base_action_log_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "mappedType": "uuid" }, "locked_at": { "name": "locked_at", "type": "timestamptz", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "length": 6, "mappedType": "datetime" }, "last_heartbeat_at": { "name": "last_heartbeat_at", "type": "timestamptz", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "length": 6, "mappedType": "datetime" }, "expires_at": { "name": "expires_at", "type": "timestamptz", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "length": 6, "mappedType": "datetime" }, "released_at": { "name": "released_at", "type": "timestamptz", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "length": 6, "mappedType": "datetime" }, "released_by_user_id": { "name": "released_by_user_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "mappedType": "uuid" }, "release_reason": { "name": "release_reason", "type": "text", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "mappedType": "text" }, "tenant_id": { "name": "tenant_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "mappedType": "uuid" }, "organization_id": { "name": "organization_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "mappedType": "uuid" }, "created_at": { "name": "created_at", "type": "timestamptz", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "length": 6, "mappedType": "datetime" }, "updated_at": { "name": "updated_at", "type": "timestamptz", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "length": 6, "mappedType": "datetime" }, "deleted_at": { "name": "deleted_at", "type": "timestamptz", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "length": 6, "mappedType": "datetime" } }, "name": "record_locks", "schema": "public", "indexes": [ { "keyName": "record_locks_active_scope_user_tenant_unique", "columnNames": [], "composite": false, "constraint": false, "primary": false, "unique": false, "expression": "create unique index \"record_locks_active_scope_user_tenant_unique\" on \"record_locks\" (\"tenant_id\", \"resource_kind\", \"resource_id\", \"locked_by_user_id\") where deleted_at is null and status = 'active' and organization_id is null" }, { "keyName": "record_locks_active_scope_user_org_unique", "columnNames": [], "composite": false, "constraint": false, "primary": false, "unique": false, "expression": "create unique index \"record_locks_active_scope_user_org_unique\" on \"record_locks\" (\"tenant_id\", \"organization_id\", \"resource_kind\", \"resource_id\", \"locked_by_user_id\") where deleted_at is null and status = 'active' and organization_id is not null" }, { "keyName": "record_locks_expiry_status_idx", "columnNames": [ "tenant_id", "expires_at", "status" ], "composite": true, "constraint": false, "primary": false, "unique": false }, { "keyName": "record_locks_owner_status_idx", "columnNames": [ "tenant_id", "locked_by_user_id", "status" ], "composite": true, "constraint": false, "primary": false, "unique": false }, { "keyName": "record_locks_resource_status_idx", "columnNames": [ "tenant_id", "resource_kind", "resource_id", "status" ], "composite": true, "constraint": false, "primary": false, "unique": false }, { "keyName": "record_locks_token_unique", "columnNames": [ "token" ], "composite": false, "constraint": true, "primary": false, "unique": true }, { "keyName": "record_locks_pkey", "columnNames": [ "id" ], "composite": false, "constraint": true, "primary": true, "unique": true } ], "checks": [], "foreignKeys": {}, "nativeEnums": {} }, { "columns": { "id": { "name": "id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "default": "gen_random_uuid()", "mappedType": "uuid" }, "resource_kind": { "name": "resource_kind", "type": "text", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "mappedType": "text" }, "resource_id": { "name": "resource_id", "type": "text", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "mappedType": "text" }, "status": { "name": "status", "type": "text", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "default": "'pending'", "mappedType": "text" }, "resolution": { "name": "resolution", "type": "text", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "mappedType": "text" }, "base_action_log_id": { "name": "base_action_log_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "mappedType": "uuid" }, "incoming_action_log_id": { "name": "incoming_action_log_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "mappedType": "uuid" }, "conflict_actor_user_id": { "name": "conflict_actor_user_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "mappedType": "uuid" }, "incoming_actor_user_id": { "name": "incoming_actor_user_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "mappedType": "uuid" }, "resolved_by_user_id": { "name": "resolved_by_user_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "mappedType": "uuid" }, "resolved_at": { "name": "resolved_at", "type": "timestamptz", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "length": 6, "mappedType": "datetime" }, "tenant_id": { "name": "tenant_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "mappedType": "uuid" }, "organization_id": { "name": "organization_id", "type": "uuid", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "mappedType": "uuid" }, "created_at": { "name": "created_at", "type": "timestamptz", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "length": 6, "mappedType": "datetime" }, "updated_at": { "name": "updated_at", "type": "timestamptz", "unsigned": false, "autoincrement": false, "primary": false, "nullable": false, "length": 6, "mappedType": "datetime" }, "deleted_at": { "name": "deleted_at", "type": "timestamptz", "unsigned": false, "autoincrement": false, "primary": false, "nullable": true, "length": 6, "mappedType": "datetime" } }, "name": "record_lock_conflicts", "schema": "public", "indexes": [ { "keyName": "record_lock_conflicts_users_idx", "columnNames": [ "tenant_id", "conflict_actor_user_id", "incoming_actor_user_id", "created_at" ], "composite": true, "constraint": false, "primary": false, "unique": false }, { "keyName": "record_lock_conflicts_resource_idx", "columnNames": [ "tenant_id", "resource_kind", "resource_id", "status", "created_at" ], "composite": true, "constraint": false, "primary": false, "unique": false }, { "keyName": "record_lock_conflicts_pkey", "columnNames": [ "id" ], "composite": false, "constraint": true, "primary": true, "unique": true } ], "checks": [], "foreignKeys": {}, "nativeEnums": {} } ], "nativeEnums": {} }