Skip to content

Commit

Permalink
feat: create feature flag table (bloom-housing#4475) (#947)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcgarrye authored Nov 14, 2024
1 parent 745a52c commit 363e5bc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
32 changes: 32 additions & 0 deletions api/prisma/migrations/20_create_feature_flag_table/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-- CreateTable
CREATE TABLE "feature_flags" (
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
"created_at" TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(6) NOT NULL,
"name" TEXT NOT NULL,
"description" TEXT NOT NULL,
"active" BOOLEAN NOT NULL DEFAULT true,

CONSTRAINT "feature_flags_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "_FeatureFlagsToJurisdictions" (
"A" UUID NOT NULL,
"B" UUID NOT NULL
);

-- CreateIndex
CREATE UNIQUE INDEX "feature_flags_name_key" ON "feature_flags"("name");

-- CreateIndex
CREATE UNIQUE INDEX "_FeatureFlagsToJurisdictions_AB_unique" ON "_FeatureFlagsToJurisdictions"("A", "B");

-- CreateIndex
CREATE INDEX "_FeatureFlagsToJurisdictions_B_index" ON "_FeatureFlagsToJurisdictions"("B");

-- AddForeignKey
ALTER TABLE "_FeatureFlagsToJurisdictions" ADD CONSTRAINT "_FeatureFlagsToJurisdictions_A_fkey" FOREIGN KEY ("A") REFERENCES "feature_flags"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "_FeatureFlagsToJurisdictions" ADD CONSTRAINT "_FeatureFlagsToJurisdictions_B_fkey" FOREIGN KEY ("B") REFERENCES "jurisdictions"("id") ON DELETE CASCADE ON UPDATE CASCADE;
13 changes: 13 additions & 0 deletions api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,18 @@ model Demographics {
@@map("demographics")
}

model FeatureFlags {
id String @id() @default(dbgenerated("uuid_generate_v4()")) @db.Uuid
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(6)
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamp(6)
name String @unique()
description String
active Boolean @default(true)
jurisdictions Jurisdictions[]
@@map("feature_flags")
}

model GeneratedListingTranslations {
id String @id() @default(dbgenerated("uuid_generate_v4()")) @db.Uuid
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(6)
Expand Down Expand Up @@ -340,6 +352,7 @@ model Jurisdictions {
enableGeocodingRadiusMethod Boolean @default(false) @map("enable_geocoding_radius_method")
allowSingleUseCodeLogin Boolean @default(false) @map("allow_single_use_code_login")
amiChart AmiChart[]
featureFlags FeatureFlags[]
multiselectQuestions MultiselectQuestions[]
listings Listings[]
reservedCommunityTypes ReservedCommunityTypes[]
Expand Down

0 comments on commit 363e5bc

Please sign in to comment.