зеркало из https://github.com/golang/pkgsite.git
migrations: add OWNED BY for sequence
The OWNED BY option causes the sequence to be associated with a specific table column, such that if that column (or its whole table) is dropped, the sequence will be automatically dropped as well. Change-Id: Ieedbf0a93e3fd7f7567417f128f291c53f3358d8 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/296449 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org>
This commit is contained in:
Родитель
41ca6b309e
Коммит
bba1b80fb0
|
@ -9,6 +9,5 @@ ALTER TABLE documentation DROP COLUMN new_goos;
|
|||
ALTER TABLE documentation DROP COLUMN new_goarch;
|
||||
DROP TRIGGER documentation_id_update ON documentation;
|
||||
DROP FUNCTION update_documentation_id;
|
||||
DROP SEQUENCE sequence_documentation_id;
|
||||
|
||||
END;
|
||||
|
|
|
@ -15,6 +15,7 @@ BEGIN
|
|||
RETURN NEW;
|
||||
END
|
||||
$BODY$ LANGUAGE PLPGSQL;
|
||||
ALTER SEQUENCE sequence_documentation_id OWNED BY documentation.id;
|
||||
|
||||
CREATE TRIGGER documentation_id_update
|
||||
BEFORE INSERT OR UPDATE ON documentation
|
||||
|
|
Загрузка…
Ссылка в новой задаче