-- +goose Up -- Each blog gets its own database; the registry remembers which one. -- db_name stays nullable until the Go migration 00006 has moved the content. ALTER TABLE blogs ADD COLUMN db_name text UNIQUE; -- "blog_" + subdomain must fit in a 63-char Postgres identifier. ALTER TABLE blogs DROP CONSTRAINT blogs_subdomain_check; ALTER TABLE blogs ADD CONSTRAINT blogs_subdomain_check CHECK (subdomain ~ '^[a-z0-9](-?[a-z0-9]){0,57}$'); -- +goose Down ALTER TABLE blogs DROP CONSTRAINT blogs_subdomain_check; ALTER TABLE blogs ADD CONSTRAINT blogs_subdomain_check CHECK (subdomain ~ '^[a-z0-9](-?[a-z0-9]){0,62}$'); ALTER TABLE blogs DROP COLUMN db_name;