-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add team_themes
table
#2602
Changes from all commits
9530221
bc280ad
d865124
e8d01fa
fc3aa02
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
COMMENT ON COLUMN "public"."team_themes"."secondary_colour" IS NULL; | ||
|
||
COMMENT ON COLUMN "public"."team_themes"."primary_colour" IS NULL; | ||
|
||
ALTER TABLE "public"."team_themes" DROP CONSTRAINT "team_themes_team_id_key"; | ||
|
||
DROP TABLE "public"."team_themes"; | ||
|
||
ALTER TABLE "public"."teams" ADD COLUMN "theme" JSONB; | ||
|
||
ALTER TABLE "public"."teams" ALTER COLUMN "theme" SET DEFAULT '{}'::JSONB; | ||
|
||
ALTER TABLE "public"."teams" ALTER COLUMN "theme" DROP NOT NULL; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
CREATE TABLE "public"."team_themes" ( | ||
"id" serial NOT NULL, | ||
"team_id" integer NOT NULL, | ||
"primary_colour" text NOT NULL DEFAULT '#0010A4', | ||
"secondary_colour" text, | ||
"logo" text, | ||
"favicon" text, | ||
PRIMARY KEY ("id"), | ||
FOREIGN KEY ("team_id") REFERENCES "public"."teams"("id") ON UPDATE cascade ON DELETE cascade | ||
); | ||
|
||
ALTER TABLE | ||
"public"."team_themes" | ||
ADD | ||
CONSTRAINT "team_themes_team_id_key" UNIQUE ("team_id"); | ||
|
||
COMMENT ON COLUMN "public"."team_themes"."primary_colour" IS E'Must be hex triplet (e.g. #112233)'; | ||
|
||
COMMENT ON COLUMN "public"."team_themes"."secondary_colour" IS E'Must be hex triplet (e.g. #112233)'; | ||
|
||
INSERT INTO | ||
team_themes (team_id, primary_colour, logo) | ||
SELECT | ||
id AS team_id, | ||
COALESCE(theme ->> 'primary', '#0010A4') AS primary_colour, | ||
COALESCE(theme ->> 'logo', NULL) AS logo | ||
FROM | ||
teams; | ||
|
||
ALTER TABLE "public"."teams" DROP COLUMN "theme" CASCADE; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Migrating and then dropping the column will work on staging and prod, but on the initial migration on Pizza and locally it won't do anything as the data sync happens after Hasura migrations run. I tested this locally without dropping the column. If preferred, I can split this into two steps / two PRs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check with @ianjon3s in the new year how we should handle defaults for this column.