Skip to content

Commit ec07423

Browse files
authored
Merge pull request #120 from puzed/codex/fix-otp-enforcement-migration-issue
2 parents 2b46b76 + 5805ba0 commit ec07423

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

packages/api/drizzle/0015_org_force_otp.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
ALTER TABLE "organizations"
22
ADD COLUMN IF NOT EXISTS "force_otp" boolean NOT NULL DEFAULT false;
33
--> statement-breakpoint
4+
UPDATE "organizations" o
5+
SET "force_otp" = true
6+
WHERE EXISTS (
7+
SELECT 1
8+
FROM "organization_members" om
9+
INNER JOIN "organization_member_roles" omr ON omr."organization_member_id" = om."id"
10+
INNER JOIN "roles" r ON r."id" = omr."role_id"
11+
WHERE om."organization_id" = o."id" AND r."key" = 'otp_required'
12+
);
13+
--> statement-breakpoint
414
DELETE FROM "organization_member_roles" omr
515
USING "roles" r
616
WHERE omr."role_id" = r."id" AND r."key" = 'otp_required';

0 commit comments

Comments
 (0)