diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-05-26 14:51:39 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-05-26 14:51:39 +0100 |
| commit | f653f5d20add3bf47abda725a6bf741aaf1406fd (patch) | |
| tree | 6776775de06d97612f4cb48efd94022222d24db9 | |
| parent | a05a9f2fcb2b1a38482fe8f8cbaa1e7ec7a15a29 (diff) | |
| download | users-f653f5d20add3bf47abda725a6bf741aaf1406fd.tar.gz users-f653f5d20add3bf47abda725a6bf741aaf1406fd.tar.bz2 users-f653f5d20add3bf47abda725a6bf741aaf1406fd.zip | |
Add users_auth_map table for OAuth/external authentication provider support
5.0.1 upgrade creates the table for existing installs; schema_inc.php
updated so fresh installs also get it. FK constraint registered via
registerSchemaConstraints (not inline DataDict, which breaks Firebird).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rw-r--r-- | admin/schema_inc.php | 1 | ||||
| -rw-r--r-- | admin/upgrades/5.0.1.php | 38 |
2 files changed, 39 insertions, 0 deletions
diff --git a/admin/schema_inc.php b/admin/schema_inc.php index 5c26b67..3882248 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -43,6 +43,7 @@ $tables = [ user_id I4 PRIMARY, provider C(64) PRIMARY, provider_identifier C(64) NOTNULL, + last_login I8, profile_json X ", diff --git a/admin/upgrades/5.0.1.php b/admin/upgrades/5.0.1.php new file mode 100644 index 0000000..d4bcbde --- /dev/null +++ b/admin/upgrades/5.0.1.php @@ -0,0 +1,38 @@ +<?php +/** + * @package users + */ + +global $gBitInstaller; + +$gBitInstaller->registerPackageUpgrade( + [ + 'package' => USERS_PKG_NAME, + 'version' => '5.0.1', + 'description' => 'Add users_auth_map table for OAuth/external authentication provider support.', + ], + [ + [ 'DATADICT' => [ + [ 'CREATE' => [ + 'users_auth_map' => " + user_id I4 PRIMARY, + provider C(64) PRIMARY, + provider_identifier C(64) NOTNULL, + last_login I8, + profile_json X + ", + ]], + [ 'CREATEINDEX' => [ + 'users_auth_user_idx' => [ 'users_auth_map', 'user_id', null ], + 'users_auth_provider_ident_idx' => [ 'users_auth_map', 'provider,provider_identifier', [ 'UNIQUE' ] ], + ]], + ]], + ] +); + +$constraints = [ + 'users_auth_map' => [ 'users_auth_user_ref' => 'FOREIGN KEY (`user_id`) REFERENCES `' . BIT_DB_PREFIX . 'users_users` (`user_id`)' ], +]; +foreach( array_keys( $constraints ) as $tableName ) { + $gBitInstaller->registerSchemaConstraints( USERS_PKG_NAME, $tableName, $constraints[$tableName] ); +} |
