refactor: refs #8573 update before alter table
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
f12c47cdf8
commit
caa921020d
|
@ -1,9 +1,9 @@
|
||||||
ALTER TABLE vn.expedition
|
UPDATE vn.expedition e
|
||||||
MODIFY COLUMN hostFk VARCHAR(30) COLLATE utf8mb3_general_ci;
|
JOIN (
|
||||||
|
SELECT id
|
||||||
ALTER TABLE vn.expedition
|
FROM vn.expedition
|
||||||
ADD CONSTRAINT fk_expedition_host_code
|
WHERE hostFk COLLATE utf8mb3_unicode_ci NOT IN
|
||||||
FOREIGN KEY (hostFk)
|
(SELECT code COLLATE utf8mb3_unicode_ci FROM host WHERE code IS NOT NULL)
|
||||||
REFERENCES host(code)
|
) s
|
||||||
ON UPDATE CASCADE
|
ON e.id = s.id
|
||||||
ON DELETE CASCADE;
|
SET e.hostFk = 'pc336';
|
|
@ -0,0 +1,9 @@
|
||||||
|
ALTER TABLE vn.expedition
|
||||||
|
MODIFY COLUMN hostFk VARCHAR(30) COLLATE utf8mb3_general_ci;
|
||||||
|
|
||||||
|
ALTER TABLE vn.expedition
|
||||||
|
ADD CONSTRAINT fk_expedition_host_code
|
||||||
|
FOREIGN KEY (hostFk)
|
||||||
|
REFERENCES host(code)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE;
|
Loading…
Reference in New Issue