diff --git a/SQL/mysql.initial.sql b/SQL/mysql.initial.sql index 6b0df0a..756c18a 100644 --- a/SQL/mysql.initial.sql +++ b/SQL/mysql.initial.sql @@ -11,6 +11,9 @@ CREATE TABLE IF NOT EXISTS `ident_switch` int UNSIGNED NOT NULL UNIQUE, + `parent_id` + int UNSIGNED + DEFAULT NULL, `username` varchar(64), `password` @@ -80,5 +83,6 @@ CREATE TABLE IF NOT EXISTS `ident_switch` CONSTRAINT `fk_identity_id` FOREIGN KEY (`iid`) REFERENCES `identities`(`identity_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY(`id`), INDEX `IX_ident_switch_user_id`(`user_id`), - INDEX `IX_ident_switch_iid`(`iid`) + INDEX `IX_ident_switch_iid`(`iid`), + INDEX `IX_ident_switch_parent_id`(`parent_id`) ); diff --git a/SQL/mysql/2026021100.sql b/SQL/mysql/2026021100.sql new file mode 100644 index 0000000..e95838a --- /dev/null +++ b/SQL/mysql/2026021100.sql @@ -0,0 +1,9 @@ +-- Add alias support: parent_id links an alias identity to a parent account +ALTER TABLE `ident_switch` + ADD `parent_id` + int UNSIGNED + DEFAULT NULL + AFTER `iid`; + +ALTER TABLE `ident_switch` + ADD INDEX `IX_ident_switch_parent_id` (`parent_id`); diff --git a/SQL/postgres.initial.sql b/SQL/postgres.initial.sql index e7001c7..6f53b96 100644 --- a/SQL/postgres.initial.sql +++ b/SQL/postgres.initial.sql @@ -12,6 +12,9 @@ CREATE TABLE ident_switch NOT NULL REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE UNIQUE, + parent_id + integer + DEFAULT NULL, username varchar(64), password @@ -81,3 +84,4 @@ CREATE TABLE ident_switch CREATE INDEX IX_ident_switch_user_id ON ident_switch(user_id); CREATE INDEX IX_ident_switch_iid ON ident_switch(iid); +CREATE INDEX IX_ident_switch_parent_id ON ident_switch(parent_id); diff --git a/SQL/postgres/2026021100.sql b/SQL/postgres/2026021100.sql new file mode 100644 index 0000000..574616e --- /dev/null +++ b/SQL/postgres/2026021100.sql @@ -0,0 +1,5 @@ +-- Add alias support: parent_id links an alias identity to a parent account +ALTER TABLE ident_switch + ADD parent_id integer DEFAULT NULL; + +CREATE INDEX IX_ident_switch_parent_id ON ident_switch(parent_id); diff --git a/SQL/sqlite.initial.sql b/SQL/sqlite.initial.sql index 7a9b266..c54844c 100644 --- a/SQL/sqlite.initial.sql +++ b/SQL/sqlite.initial.sql @@ -12,6 +12,9 @@ CREATE TABLE ident_switch NOT NULL REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE UNIQUE, + parent_id + integer + DEFAULT NULL, username varchar(64), password @@ -80,3 +83,4 @@ CREATE TABLE ident_switch ); CREATE INDEX IX_ident_switch_user_id ON ident_switch(user_id); CREATE INDEX IX_ident_switch_iid ON ident_switch(iid); +CREATE INDEX IX_ident_switch_parent_id ON ident_switch(parent_id); diff --git a/SQL/sqlite/2026021000.sql b/SQL/sqlite/2026021000.sql index c808b7c..3b149a7 100644 --- a/SQL/sqlite/2026021000.sql +++ b/SQL/sqlite/2026021000.sql @@ -19,6 +19,9 @@ CREATE TABLE ident_switch NOT NULL REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE UNIQUE, + parent_id + integer + DEFAULT NULL, username varchar(64), password @@ -87,6 +90,7 @@ CREATE TABLE ident_switch ); CREATE INDEX IX_ident_switch_user_id ON ident_switch(user_id); CREATE INDEX IX_ident_switch_iid ON ident_switch(iid); +CREATE INDEX IX_ident_switch_parent_id ON ident_switch(parent_id); INSERT OR ROLLBACK INTO ident_switch ( diff --git a/SQL/sqlite/2026021100.sql b/SQL/sqlite/2026021100.sql new file mode 100644 index 0000000..88524d9 --- /dev/null +++ b/SQL/sqlite/2026021100.sql @@ -0,0 +1,4 @@ +-- Add alias support: parent_id links an alias identity to a parent account +ALTER TABLE ident_switch ADD parent_id integer DEFAULT NULL; + +CREATE INDEX IF NOT EXISTS IX_ident_switch_parent_id ON ident_switch(parent_id);