Ekklesia could authenticate a person and, since Pass 1, send a transactional email — but it had no way to establish that an address belonged to whoever claimed it, and no way back in for someone who forgot their password. A verified address is now a precondition for holding a session. Better Auth enforces that after the password check and before any session exists, so an unverified sign-in returns 403 with no cookie. That is why no "unverified principal" was needed: a correct password on an unverified address carries exactly the authority of no password, and /api/v1/principal is unchanged. Better Auth keeps every token. Ekklesia adds no token table, no hashing, and no expiry clock. It supplies a recipient, a subject, and two bodies, and the mail provider supplies everything about SMTP. Verification and reset links are rebuilt from a validated Dashboard origin, taking only the token — never the URL Better Auth prebuilds from a caller-supplied callbackURL — so no request can steer where a recipient lands. Following a verification link mints no session, because mail infrastructure dereferences links. Reset revokes that person's other sessions and leaves managed devices alone. Recovery answers identically for an address with an account, without one, already verified, or undeliverable — including when SMTP is broken, which is why the delivery adapter never throws. The initial platform owner is the one exception: created already verified by an operator command with no mail prerequisite, so a fresh server can be signed in to before a relay exists. Migration 0007 extends that to owners of installations that already exist. Public signup stays disabled; verification is not a licence to self-register. Co-Authored-By: Claude Opus 5 <[email protected]>
1371 lines
40 KiB
JSON
1371 lines
40 KiB
JSON
{
|
|
"id": "d435c98f-67b6-4c37-89a9-820036fdf444",
|
|
"prevId": "2b1ddb4b-3185-417b-9920-100e35fedb36",
|
|
"version": "7",
|
|
"dialect": "postgresql",
|
|
"tables": {
|
|
"public.ekklesia_core_account": {
|
|
"name": "ekklesia_core_account",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"account_id": {
|
|
"name": "account_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"provider_id": {
|
|
"name": "provider_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"access_token": {
|
|
"name": "access_token",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"refresh_token": {
|
|
"name": "refresh_token",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"id_token": {
|
|
"name": "id_token",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"access_token_expires_at": {
|
|
"name": "access_token_expires_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"refresh_token_expires_at": {
|
|
"name": "refresh_token_expires_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"scope": {
|
|
"name": "scope",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
}
|
|
},
|
|
"indexes": {
|
|
"ekklesia_core_account_user_id_idx": {
|
|
"name": "ekklesia_core_account_user_id_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "user_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"ekklesia_core_account_user_id_ekklesia_core_user_id_fk": {
|
|
"name": "ekklesia_core_account_user_id_ekklesia_core_user_id_fk",
|
|
"tableFrom": "ekklesia_core_account",
|
|
"tableTo": "ekklesia_core_user",
|
|
"columnsFrom": ["user_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_session": {
|
|
"name": "ekklesia_core_session",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"expires_at": {
|
|
"name": "expires_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"token": {
|
|
"name": "token",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"ip_address": {
|
|
"name": "ip_address",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"user_agent": {
|
|
"name": "user_agent",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
}
|
|
},
|
|
"indexes": {
|
|
"ekklesia_core_session_user_id_idx": {
|
|
"name": "ekklesia_core_session_user_id_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "user_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"ekklesia_core_session_user_id_ekklesia_core_user_id_fk": {
|
|
"name": "ekklesia_core_session_user_id_ekklesia_core_user_id_fk",
|
|
"tableFrom": "ekklesia_core_session",
|
|
"tableTo": "ekklesia_core_user",
|
|
"columnsFrom": ["user_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"ekklesia_core_session_token_unique": {
|
|
"name": "ekklesia_core_session_token_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": ["token"]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_user": {
|
|
"name": "ekklesia_core_user",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"email_verified": {
|
|
"name": "email_verified",
|
|
"type": "boolean",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": false
|
|
},
|
|
"image": {
|
|
"name": "image",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"ekklesia_core_user_email_unique": {
|
|
"name": "ekklesia_core_user_email_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": ["email"]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_verification": {
|
|
"name": "ekklesia_core_verification",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"identifier": {
|
|
"name": "identifier",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"value": {
|
|
"name": "value",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"expires_at": {
|
|
"name": "expires_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"ekklesia_core_verification_identifier_idx": {
|
|
"name": "ekklesia_core_verification_identifier_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "identifier",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_authorization_audit": {
|
|
"name": "ekklesia_core_authorization_audit",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"action": {
|
|
"name": "action",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"actor_type": {
|
|
"name": "actor_type",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"actor_id": {
|
|
"name": "actor_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"subject_user_id": {
|
|
"name": "subject_user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"permission_id": {
|
|
"name": "permission_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"scope": {
|
|
"name": "scope",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"grant_id": {
|
|
"name": "grant_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"ekklesia_core_authorization_audit_subject_idx": {
|
|
"name": "ekklesia_core_authorization_audit_subject_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "subject_user_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"ekklesia_core_authorization_audit_action_check": {
|
|
"name": "ekklesia_core_authorization_audit_action_check",
|
|
"value": "\"ekklesia_core_authorization_audit\".\"action\" in ('grant.create', 'grant.revoke', 'platform_owner.grant', 'platform_owner.revoke')"
|
|
},
|
|
"ekklesia_core_authorization_audit_actor_type_check": {
|
|
"name": "ekklesia_core_authorization_audit_actor_type_check",
|
|
"value": "\"ekklesia_core_authorization_audit\".\"actor_type\" in ('user', 'system')"
|
|
},
|
|
"ekklesia_core_authorization_audit_scope_check": {
|
|
"name": "ekklesia_core_authorization_audit_scope_check",
|
|
"value": "\"ekklesia_core_authorization_audit\".\"scope\" is null or length(\"ekklesia_core_authorization_audit\".\"scope\") > 0"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_grant": {
|
|
"name": "ekklesia_core_grant",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"permission_id": {
|
|
"name": "permission_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"scope": {
|
|
"name": "scope",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"source_kind": {
|
|
"name": "source_kind",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"source_ref": {
|
|
"name": "source_ref",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"created_by_actor_type": {
|
|
"name": "created_by_actor_type",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"created_by_actor_id": {
|
|
"name": "created_by_actor_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"expires_at": {
|
|
"name": "expires_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"revoked_at": {
|
|
"name": "revoked_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"revoked_by_actor_type": {
|
|
"name": "revoked_by_actor_type",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"revoked_by_actor_id": {
|
|
"name": "revoked_by_actor_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
}
|
|
},
|
|
"indexes": {
|
|
"ekklesia_core_grant_user_permission_idx": {
|
|
"name": "ekklesia_core_grant_user_permission_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "user_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
},
|
|
{
|
|
"expression": "permission_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"ekklesia_core_grant_user_id_ekklesia_core_user_id_fk": {
|
|
"name": "ekklesia_core_grant_user_id_ekklesia_core_user_id_fk",
|
|
"tableFrom": "ekklesia_core_grant",
|
|
"tableTo": "ekklesia_core_user",
|
|
"columnsFrom": ["user_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"ekklesia_core_grant_source_kind_check": {
|
|
"name": "ekklesia_core_grant_source_kind_check",
|
|
"value": "\"ekklesia_core_grant\".\"source_kind\" in ('explicit', 'relationship')"
|
|
},
|
|
"ekklesia_core_grant_created_actor_type_check": {
|
|
"name": "ekklesia_core_grant_created_actor_type_check",
|
|
"value": "\"ekklesia_core_grant\".\"created_by_actor_type\" in ('user', 'system')"
|
|
},
|
|
"ekklesia_core_grant_revoked_actor_type_check": {
|
|
"name": "ekklesia_core_grant_revoked_actor_type_check",
|
|
"value": "\"ekklesia_core_grant\".\"revoked_by_actor_type\" is null or \"ekklesia_core_grant\".\"revoked_by_actor_type\" in ('user', 'system')"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_platform_owner": {
|
|
"name": "ekklesia_core_platform_owner",
|
|
"schema": "",
|
|
"columns": {
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"granted_at": {
|
|
"name": "granted_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"granted_by_actor_type": {
|
|
"name": "granted_by_actor_type",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"granted_by_actor_id": {
|
|
"name": "granted_by_actor_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"revoked_at": {
|
|
"name": "revoked_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"revoked_by_actor_type": {
|
|
"name": "revoked_by_actor_type",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"revoked_by_actor_id": {
|
|
"name": "revoked_by_actor_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"ekklesia_core_platform_owner_user_id_ekklesia_core_user_id_fk": {
|
|
"name": "ekklesia_core_platform_owner_user_id_ekklesia_core_user_id_fk",
|
|
"tableFrom": "ekklesia_core_platform_owner",
|
|
"tableTo": "ekklesia_core_user",
|
|
"columnsFrom": ["user_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"ekklesia_core_platform_owner_granted_actor_type_check": {
|
|
"name": "ekklesia_core_platform_owner_granted_actor_type_check",
|
|
"value": "\"ekklesia_core_platform_owner\".\"granted_by_actor_type\" in ('user', 'system')"
|
|
},
|
|
"ekklesia_core_platform_owner_revoked_actor_type_check": {
|
|
"name": "ekklesia_core_platform_owner_revoked_actor_type_check",
|
|
"value": "\"ekklesia_core_platform_owner\".\"revoked_by_actor_type\" is null or \"ekklesia_core_platform_owner\".\"revoked_by_actor_type\" in ('user', 'system')"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_platform_owner_bootstrap": {
|
|
"name": "ekklesia_core_platform_owner_bootstrap",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"consumed_at": {
|
|
"name": "consumed_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"consumed_for_user_id": {
|
|
"name": "consumed_for_user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"ekklesia_core_platform_owner_bootstrap_singleton_check": {
|
|
"name": "ekklesia_core_platform_owner_bootstrap_singleton_check",
|
|
"value": "\"ekklesia_core_platform_owner_bootstrap\".\"id\" = 'singleton'"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_dashboard_group": {
|
|
"name": "ekklesia_core_dashboard_group",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"label": {
|
|
"name": "label",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"sort_order": {
|
|
"name": "sort_order",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": 0
|
|
},
|
|
"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": {
|
|
"ekklesia_core_dashboard_group_order_idx": {
|
|
"name": "ekklesia_core_dashboard_group_order_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "sort_order",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
},
|
|
{
|
|
"expression": "id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"ekklesia_core_dashboard_group_id_check": {
|
|
"name": "ekklesia_core_dashboard_group_id_check",
|
|
"value": "length(\"ekklesia_core_dashboard_group\".\"id\") > 0"
|
|
},
|
|
"ekklesia_core_dashboard_group_label_check": {
|
|
"name": "ekklesia_core_dashboard_group_label_check",
|
|
"value": "length(btrim(\"ekklesia_core_dashboard_group\".\"label\")) > 0"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_dashboard_placement": {
|
|
"name": "ekklesia_core_dashboard_placement",
|
|
"schema": "",
|
|
"columns": {
|
|
"module_id": {
|
|
"name": "module_id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"group_id": {
|
|
"name": "group_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"sort_order": {
|
|
"name": "sort_order",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": 0
|
|
},
|
|
"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": {
|
|
"ekklesia_core_dashboard_placement_group_idx": {
|
|
"name": "ekklesia_core_dashboard_placement_group_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "group_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
},
|
|
{
|
|
"expression": "sort_order",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"ekklesia_core_dashboard_placement_group_id_ekklesia_core_dashboard_group_id_fk": {
|
|
"name": "ekklesia_core_dashboard_placement_group_id_ekklesia_core_dashboard_group_id_fk",
|
|
"tableFrom": "ekklesia_core_dashboard_placement",
|
|
"tableTo": "ekklesia_core_dashboard_group",
|
|
"columnsFrom": ["group_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "set null",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"ekklesia_core_dashboard_placement_module_check": {
|
|
"name": "ekklesia_core_dashboard_placement_module_check",
|
|
"value": "length(\"ekklesia_core_dashboard_placement\".\"module_id\") > 0"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_module_state": {
|
|
"name": "ekklesia_core_module_state",
|
|
"schema": "",
|
|
"columns": {
|
|
"module_id": {
|
|
"name": "module_id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"enabled": {
|
|
"name": "enabled",
|
|
"type": "boolean",
|
|
"primaryKey": false,
|
|
"notNull": 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": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"ekklesia_core_module_state_module_check": {
|
|
"name": "ekklesia_core_module_state_module_check",
|
|
"value": "length(\"ekklesia_core_module_state\".\"module_id\") > 0"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_module_configuration": {
|
|
"name": "ekklesia_core_module_configuration",
|
|
"schema": "",
|
|
"columns": {
|
|
"module_id": {
|
|
"name": "module_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"key": {
|
|
"name": "key",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"value": {
|
|
"name": "value",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": 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": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"ekklesia_core_module_configuration_module_idx": {
|
|
"name": "ekklesia_core_module_configuration_module_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "module_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {
|
|
"ekklesia_core_module_configuration_module_id_key_pk": {
|
|
"name": "ekklesia_core_module_configuration_module_id_key_pk",
|
|
"columns": ["module_id", "key"]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"ekklesia_core_module_configuration_module_check": {
|
|
"name": "ekklesia_core_module_configuration_module_check",
|
|
"value": "length(\"ekklesia_core_module_configuration\".\"module_id\") > 0"
|
|
},
|
|
"ekklesia_core_module_configuration_key_check": {
|
|
"name": "ekklesia_core_module_configuration_key_check",
|
|
"value": "length(\"ekklesia_core_module_configuration\".\"key\") > 0"
|
|
},
|
|
"ekklesia_core_module_configuration_value_check": {
|
|
"name": "ekklesia_core_module_configuration_value_check",
|
|
"value": "length(\"ekklesia_core_module_configuration\".\"value\") <= 2048"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_device": {
|
|
"name": "ekklesia_core_device",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"credential_hash": {
|
|
"name": "credential_hash",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"created_by_user_id": {
|
|
"name": "created_by_user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"last_seen_at": {
|
|
"name": "last_seen_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"revoked_at": {
|
|
"name": "revoked_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"revoked_by_user_id": {
|
|
"name": "revoked_by_user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
}
|
|
},
|
|
"indexes": {
|
|
"ekklesia_core_device_credential_hash_idx": {
|
|
"name": "ekklesia_core_device_credential_hash_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "credential_hash",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": true,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"ekklesia_core_device_revoked_idx": {
|
|
"name": "ekklesia_core_device_revoked_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "revoked_at",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"ekklesia_core_device_created_by_user_id_ekklesia_core_user_id_fk": {
|
|
"name": "ekklesia_core_device_created_by_user_id_ekklesia_core_user_id_fk",
|
|
"tableFrom": "ekklesia_core_device",
|
|
"tableTo": "ekklesia_core_user",
|
|
"columnsFrom": ["created_by_user_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "set null",
|
|
"onUpdate": "no action"
|
|
},
|
|
"ekklesia_core_device_revoked_by_user_id_ekklesia_core_user_id_fk": {
|
|
"name": "ekklesia_core_device_revoked_by_user_id_ekklesia_core_user_id_fk",
|
|
"tableFrom": "ekklesia_core_device",
|
|
"tableTo": "ekklesia_core_user",
|
|
"columnsFrom": ["revoked_by_user_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "set null",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"ekklesia_core_device_name_check": {
|
|
"name": "ekklesia_core_device_name_check",
|
|
"value": "length(\"ekklesia_core_device\".\"name\") between 1 and 128"
|
|
},
|
|
"ekklesia_core_device_credential_hash_check": {
|
|
"name": "ekklesia_core_device_credential_hash_check",
|
|
"value": "length(\"ekklesia_core_device\".\"credential_hash\") = 64"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_device_pairing_request": {
|
|
"name": "ekklesia_core_device_pairing_request",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"code": {
|
|
"name": "code",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"claim_secret_hash": {
|
|
"name": "claim_secret_hash",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"module_id": {
|
|
"name": "module_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"permission_id": {
|
|
"name": "permission_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"state": {
|
|
"name": "state",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "'pending'"
|
|
},
|
|
"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
|
|
},
|
|
"device_name": {
|
|
"name": "device_name",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"approved_at": {
|
|
"name": "approved_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"approved_by_user_id": {
|
|
"name": "approved_by_user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"consumed_at": {
|
|
"name": "consumed_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"device_id": {
|
|
"name": "device_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
}
|
|
},
|
|
"indexes": {
|
|
"ekklesia_core_device_pairing_code_idx": {
|
|
"name": "ekklesia_core_device_pairing_code_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "code",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": true,
|
|
"where": "\"ekklesia_core_device_pairing_request\".\"state\" <> 'consumed'",
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
},
|
|
"ekklesia_core_device_pairing_claim_idx": {
|
|
"name": "ekklesia_core_device_pairing_claim_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "claim_secret_hash",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"ekklesia_core_device_pairing_request_approved_by_user_id_ekklesia_core_user_id_fk": {
|
|
"name": "ekklesia_core_device_pairing_request_approved_by_user_id_ekklesia_core_user_id_fk",
|
|
"tableFrom": "ekklesia_core_device_pairing_request",
|
|
"tableTo": "ekklesia_core_user",
|
|
"columnsFrom": ["approved_by_user_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "set null",
|
|
"onUpdate": "no action"
|
|
},
|
|
"ekklesia_core_device_pairing_request_device_id_ekklesia_core_device_id_fk": {
|
|
"name": "ekklesia_core_device_pairing_request_device_id_ekklesia_core_device_id_fk",
|
|
"tableFrom": "ekklesia_core_device_pairing_request",
|
|
"tableTo": "ekklesia_core_device",
|
|
"columnsFrom": ["device_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "set null",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"ekklesia_core_device_pairing_code_check": {
|
|
"name": "ekklesia_core_device_pairing_code_check",
|
|
"value": "\"ekklesia_core_device_pairing_request\".\"code\" ~ '^[0-9]{6}$'"
|
|
},
|
|
"ekklesia_core_device_pairing_claim_hash_check": {
|
|
"name": "ekklesia_core_device_pairing_claim_hash_check",
|
|
"value": "length(\"ekklesia_core_device_pairing_request\".\"claim_secret_hash\") = 64"
|
|
},
|
|
"ekklesia_core_device_pairing_state_check": {
|
|
"name": "ekklesia_core_device_pairing_state_check",
|
|
"value": "\"ekklesia_core_device_pairing_request\".\"state\" in ('pending', 'approved', 'consumed')"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.ekklesia_core_device_permission": {
|
|
"name": "ekklesia_core_device_permission",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"device_id": {
|
|
"name": "device_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"permission_id": {
|
|
"name": "permission_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"granted_at": {
|
|
"name": "granted_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"granted_by_user_id": {
|
|
"name": "granted_by_user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"revoked_at": {
|
|
"name": "revoked_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
}
|
|
},
|
|
"indexes": {
|
|
"ekklesia_core_device_permission_lookup_idx": {
|
|
"name": "ekklesia_core_device_permission_lookup_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "device_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
},
|
|
{
|
|
"expression": "permission_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"ekklesia_core_device_permission_device_id_ekklesia_core_device_id_fk": {
|
|
"name": "ekklesia_core_device_permission_device_id_ekklesia_core_device_id_fk",
|
|
"tableFrom": "ekklesia_core_device_permission",
|
|
"tableTo": "ekklesia_core_device",
|
|
"columnsFrom": ["device_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"ekklesia_core_device_permission_granted_by_user_id_ekklesia_core_user_id_fk": {
|
|
"name": "ekklesia_core_device_permission_granted_by_user_id_ekklesia_core_user_id_fk",
|
|
"tableFrom": "ekklesia_core_device_permission",
|
|
"tableTo": "ekklesia_core_user",
|
|
"columnsFrom": ["granted_by_user_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "set null",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"ekklesia_core_device_permission_id_check": {
|
|
"name": "ekklesia_core_device_permission_id_check",
|
|
"value": "length(\"ekklesia_core_device_permission\".\"permission_id\") between 1 and 128"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
}
|
|
},
|
|
"enums": {},
|
|
"schemas": {},
|
|
"sequences": {},
|
|
"roles": {},
|
|
"policies": {},
|
|
"views": {},
|
|
"_meta": {
|
|
"columns": {},
|
|
"schemas": {},
|
|
"tables": {}
|
|
}
|
|
}
|