From ede95592a374be27520d5c95e4eb375def44da05 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 28 Jan 2026 10:42:47 +0000 Subject: [PATCH 1/2] refactor: replace tokens_module with sessions_module in export - Replace tokens_module with sessions_module in tableOrder (export-migrations.ts) - Replace tokens_module config with sessions_module config (export-meta.ts) - Remove tokens_table_id from rls_module config - Remove tokens_table_id from user_auth_module config - Update crypto_auth_module to use sessions_table_id and session_credentials_table_id --- pgpm/core/src/export/export-meta.ts | 23 +++++++++++++---------- pgpm/core/src/export/export-migrations.ts | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pgpm/core/src/export/export-meta.ts b/pgpm/core/src/export/export-meta.ts index bb6c7d842..d84c1ff9a 100644 --- a/pgpm/core/src/export/export-meta.ts +++ b/pgpm/core/src/export/export-meta.ts @@ -467,7 +467,6 @@ const config: Record = { api_id: 'uuid', schema_id: 'uuid', private_schema_id: 'uuid', - tokens_table_id: 'uuid', users_table_id: 'uuid', authenticate: 'text', authenticate_strict: 'text', @@ -486,7 +485,6 @@ const config: Record = { users_table_id: 'uuid', secrets_table_id: 'uuid', encrypted_table_id: 'uuid', - tokens_table_id: 'uuid', sign_in_function: 'text', sign_up_function: 'text', sign_out_function: 'text', @@ -701,17 +699,21 @@ const config: Record = { table_name: 'text' } }, - tokens_module: { + sessions_module: { schema: 'metaschema_modules_public', - table: 'tokens_module', + table: 'sessions_module', fields: { id: 'uuid', database_id: 'uuid', schema_id: 'uuid', - table_id: 'uuid', - owned_table_id: 'uuid', - tokens_default_expiration: 'interval', - tokens_table: 'text' + sessions_table_id: 'uuid', + session_credentials_table_id: 'uuid', + auth_settings_table_id: 'uuid', + users_table_id: 'uuid', + sessions_default_expiration: 'interval', + sessions_table: 'text', + session_credentials_table: 'text', + auth_settings_table: 'text' } }, secrets_module: { @@ -809,7 +811,8 @@ const config: Record = { database_id: 'uuid', schema_id: 'uuid', users_table_id: 'uuid', - tokens_table_id: 'uuid', + sessions_table_id: 'uuid', + session_credentials_table_id: 'uuid', secrets_table_id: 'uuid', addresses_table_id: 'uuid', user_field: 'text', @@ -1024,7 +1027,7 @@ export const exportMeta = async ({ opts, dbname, database_id }: ExportMetaParams await queryAndParse('membership_types_module', `SELECT * FROM metaschema_modules_public.membership_types_module WHERE database_id = $1`); await queryAndParse('invites_module', `SELECT * FROM metaschema_modules_public.invites_module WHERE database_id = $1`); await queryAndParse('emails_module', `SELECT * FROM metaschema_modules_public.emails_module WHERE database_id = $1`); - await queryAndParse('tokens_module', `SELECT * FROM metaschema_modules_public.tokens_module WHERE database_id = $1`); + await queryAndParse('sessions_module', `SELECT * FROM metaschema_modules_public.sessions_module WHERE database_id = $1`); await queryAndParse('secrets_module', `SELECT * FROM metaschema_modules_public.secrets_module WHERE database_id = $1`); await queryAndParse('profiles_module', `SELECT * FROM metaschema_modules_public.profiles_module WHERE database_id = $1`); await queryAndParse('encrypted_secrets_module', `SELECT * FROM metaschema_modules_public.encrypted_secrets_module WHERE database_id = $1`); diff --git a/pgpm/core/src/export/export-migrations.ts b/pgpm/core/src/export/export-migrations.ts index 1087afb51..d2121121d 100644 --- a/pgpm/core/src/export/export-migrations.ts +++ b/pgpm/core/src/export/export-migrations.ts @@ -398,7 +398,7 @@ SET session_replication_role TO DEFAULT;`; 'membership_types_module', 'invites_module', 'emails_module', - 'tokens_module', + 'sessions_module', 'secrets_module', 'profiles_module', 'encrypted_secrets_module', From be04a68117420d57f5cb01a34414ca88f169ad60 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Wed, 28 Jan 2026 10:58:59 +0000 Subject: [PATCH 2/2] fix: add sessions_table_id and session_credentials_table_id to rls_module and user_auth_module configs - Add sessions_table_id and session_credentials_table_id to rls_module config - Add sessions_table_id and session_credentials_table_id to user_auth_module config - Add missing audits_table_id, audits_table_name, verify_password_function, check_password_function to user_auth_module --- pgpm/core/src/export/export-meta.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pgpm/core/src/export/export-meta.ts b/pgpm/core/src/export/export-meta.ts index d84c1ff9a..f15c265f9 100644 --- a/pgpm/core/src/export/export-meta.ts +++ b/pgpm/core/src/export/export-meta.ts @@ -467,6 +467,8 @@ const config: Record = { api_id: 'uuid', schema_id: 'uuid', private_schema_id: 'uuid', + session_credentials_table_id: 'uuid', + sessions_table_id: 'uuid', users_table_id: 'uuid', authenticate: 'text', authenticate_strict: 'text', @@ -485,6 +487,10 @@ const config: Record = { users_table_id: 'uuid', secrets_table_id: 'uuid', encrypted_table_id: 'uuid', + sessions_table_id: 'uuid', + session_credentials_table_id: 'uuid', + audits_table_id: 'uuid', + audits_table_name: 'text', sign_in_function: 'text', sign_up_function: 'text', sign_out_function: 'text', @@ -497,7 +503,9 @@ const config: Record = { reset_password_function: 'text', forgot_password_function: 'text', send_verification_email_function: 'text', - verify_email_function: 'text' + verify_email_function: 'text', + verify_password_function: 'text', + check_password_function: 'text' } }, memberships_module: {