9 lines
258 B
MySQL
9 lines
258 B
MySQL
|
-- AlterTable
|
||
|
ALTER TABLE "Invite" ADD COLUMN "giftedCount" INTEGER NOT NULL DEFAULT 0;
|
||
|
|
||
|
-- denormalize giftedCount
|
||
|
UPDATE "Invite"
|
||
|
SET "giftedCount" = (SELECT COUNT(*) FROM "users" WHERE "users"."inviteId" = "Invite".id)
|
||
|
WHERE "Invite"."id" = "Invite".id;
|
||
|
|