Browse Source
MySQL/InnoDB silently ignores inline column-level REFERENCES, so the original migration created no foreign key at all on MySQL. Use a table-level FOREIGN KEY clause and match organizations.uuid's VARCHAR(40) type exactly so the constraint is actually created. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>pull/7443/head
1 changed files with 6 additions and 2 deletions
@ -1,8 +1,12 @@ |
|||||
|
-- org_uuid is VARCHAR(40) to match organizations.uuid exactly; the FOREIGN KEY |
||||
|
-- must be a table-level clause because MySQL silently ignores inline |
||||
|
-- column-level REFERENCES. |
||||
CREATE TABLE scim_api_key ( |
CREATE TABLE scim_api_key ( |
||||
uuid CHAR(36) NOT NULL PRIMARY KEY, |
uuid CHAR(36) NOT NULL PRIMARY KEY, |
||||
org_uuid CHAR(36) NOT NULL UNIQUE REFERENCES organizations(uuid), |
org_uuid VARCHAR(40) NOT NULL UNIQUE, |
||||
key_hash VARCHAR(255) NOT NULL, |
key_hash VARCHAR(255) NOT NULL, |
||||
enabled BOOLEAN NOT NULL DEFAULT TRUE, |
enabled BOOLEAN NOT NULL DEFAULT TRUE, |
||||
created_at DATETIME NOT NULL, |
created_at DATETIME NOT NULL, |
||||
revision_date DATETIME NOT NULL |
revision_date DATETIME NOT NULL, |
||||
|
FOREIGN KEY(org_uuid) REFERENCES organizations(uuid) |
||||
); |
); |
||||
|
|||||
Loading…
Reference in new issue