Add parent_id column for alias identity support
Migration and initial schemas for linking alias identities to parent accounts via a nullable parent_id foreign key.
This commit is contained in:
@@ -11,6 +11,9 @@ CREATE TABLE IF NOT EXISTS `ident_switch`
|
|||||||
int UNSIGNED
|
int UNSIGNED
|
||||||
NOT NULL
|
NOT NULL
|
||||||
UNIQUE,
|
UNIQUE,
|
||||||
|
`parent_id`
|
||||||
|
int UNSIGNED
|
||||||
|
DEFAULT NULL,
|
||||||
`username`
|
`username`
|
||||||
varchar(64),
|
varchar(64),
|
||||||
`password`
|
`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,
|
CONSTRAINT `fk_identity_id` FOREIGN KEY (`iid`) REFERENCES `identities`(`identity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
PRIMARY KEY(`id`),
|
PRIMARY KEY(`id`),
|
||||||
INDEX `IX_ident_switch_user_id`(`user_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`)
|
||||||
);
|
);
|
||||||
|
|||||||
9
SQL/mysql/2026021100.sql
Normal file
9
SQL/mysql/2026021100.sql
Normal file
@@ -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`);
|
||||||
@@ -12,6 +12,9 @@ CREATE TABLE ident_switch
|
|||||||
NOT NULL
|
NOT NULL
|
||||||
REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE
|
REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
UNIQUE,
|
UNIQUE,
|
||||||
|
parent_id
|
||||||
|
integer
|
||||||
|
DEFAULT NULL,
|
||||||
username
|
username
|
||||||
varchar(64),
|
varchar(64),
|
||||||
password
|
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_user_id ON ident_switch(user_id);
|
||||||
CREATE INDEX IX_ident_switch_iid ON ident_switch(iid);
|
CREATE INDEX IX_ident_switch_iid ON ident_switch(iid);
|
||||||
|
CREATE INDEX IX_ident_switch_parent_id ON ident_switch(parent_id);
|
||||||
|
|||||||
5
SQL/postgres/2026021100.sql
Normal file
5
SQL/postgres/2026021100.sql
Normal file
@@ -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);
|
||||||
@@ -12,6 +12,9 @@ CREATE TABLE ident_switch
|
|||||||
NOT NULL
|
NOT NULL
|
||||||
REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE
|
REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
UNIQUE,
|
UNIQUE,
|
||||||
|
parent_id
|
||||||
|
integer
|
||||||
|
DEFAULT NULL,
|
||||||
username
|
username
|
||||||
varchar(64),
|
varchar(64),
|
||||||
password
|
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_user_id ON ident_switch(user_id);
|
||||||
CREATE INDEX IX_ident_switch_iid ON ident_switch(iid);
|
CREATE INDEX IX_ident_switch_iid ON ident_switch(iid);
|
||||||
|
CREATE INDEX IX_ident_switch_parent_id ON ident_switch(parent_id);
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ CREATE TABLE ident_switch
|
|||||||
NOT NULL
|
NOT NULL
|
||||||
REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE
|
REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
UNIQUE,
|
UNIQUE,
|
||||||
|
parent_id
|
||||||
|
integer
|
||||||
|
DEFAULT NULL,
|
||||||
username
|
username
|
||||||
varchar(64),
|
varchar(64),
|
||||||
password
|
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_user_id ON ident_switch(user_id);
|
||||||
CREATE INDEX IX_ident_switch_iid ON ident_switch(iid);
|
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
|
INSERT OR ROLLBACK INTO
|
||||||
ident_switch (
|
ident_switch (
|
||||||
|
|||||||
4
SQL/sqlite/2026021100.sql
Normal file
4
SQL/sqlite/2026021100.sql
Normal file
@@ -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);
|
||||||
Reference in New Issue
Block a user