000014_add_not_null_constraint.up.sql
TLDR
The provided file is an SQL migration script that adds a NOT NULL constraint to the created_by
and modified_by
columns in the blocks
table.
Methods
There are no methods in this file.
Classes
There are no classes in this file.
UPDATE {{.prefix}}blocks SET created_by = 'system' where created_by IS NULL;
UPDATE {{.prefix}}blocks SET modified_by = 'system' where modified_by IS NULL;
{{if .mysql}}
ALTER TABLE {{.prefix}}blocks MODIFY created_by varchar(36) NOT NULL;
ALTER TABLE {{.prefix}}blocks MODIFY modified_by varchar(36) NOT NULL;
{{end}}
{{if .postgres}}
ALTER TABLE {{.prefix}}blocks ALTER COLUMN created_by set NOT NULL;
ALTER TABLE {{.prefix}}blocks ALTER COLUMN modified_by set NOT NULL;
{{end}}