Fix posterminal token uniqueness for nullable column
Replace inline UNIQUE constraint with filtered unique index on token column to allow multiple NULL values while maintaining uniqueness for non-NULL tokens.
This commit is contained in:
@@ -577,9 +577,9 @@ BEGIN
|
|||||||
name NVARCHAR(255) NOT NULL,
|
name NVARCHAR(255) NOT NULL,
|
||||||
token NVARCHAR(255) NULL,
|
token NVARCHAR(255) NULL,
|
||||||
pairingpin NVARCHAR(50) NOT NULL,
|
pairingpin NVARCHAR(50) NOT NULL,
|
||||||
CONSTRAINT FK_posterminal_company FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE,
|
CONSTRAINT FK_posterminal_company FOREIGN KEY (company_id) REFERENCES company(id) ON DELETE CASCADE
|
||||||
CONSTRAINT UQ_posterminal_token UNIQUE (token)
|
|
||||||
);
|
);
|
||||||
|
CREATE UNIQUE INDEX UQ_posterminal_token ON posterminal(token) WHERE token IS NOT NULL;
|
||||||
END
|
END
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user