Skip to content
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

[MAPA-433] fix: small fixes on msr tables #27

Merged
merged 4 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "pii_sec"."msr_pii" ALTER COLUMN "first_name" DROP NOT NULL,
ALTER COLUMN "last_name" DROP NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
Warnings:

- The values [unsubscribed] on the enum `msr_status` will be removed. If these variants are still used in the database, this will fail.

*/
-- AlterEnum
BEGIN;
CREATE TYPE "msr"."msr_status_new" AS ENUM ('registered', 'unregistered');
ALTER TABLE "msr"."msrs" ALTER COLUMN "status" TYPE "msr"."msr_status_new" USING ("status"::text::"msr"."msr_status_new");
ALTER TYPE "msr"."msr_status" RENAME TO "msr_status_old";
ALTER TYPE "msr"."msr_status_new" RENAME TO "msr_status";
DROP TYPE "msr"."msr_status_old";
COMMIT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Warnings:

- You are about to drop the column `last_name` on the `msr_pii` table. All the data in the column will be lost.

*/
-- AlterTable
ALTER TABLE "pii_sec"."msr_pii" DROP COLUMN "last_name";
7 changes: 3 additions & 4 deletions schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ generator client {
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
schemas = ["match", "public", "mobilization", "public_services", "msr", "pii_sec", "pii_mask"]
schemas = ["match", "public", "mobilization", "public_services", "msr", "pii_sec"]
}

model auth_group {
Expand Down Expand Up @@ -245,8 +245,7 @@ model MSRs {

model MSRPiiSec {
msrId BigInt @id @default(autoincrement()) @map("msr_id")
firstName String @map("first_name") @db.VarChar(200)
lastName String @map("last_name") @db.VarChar(200)
firstName String? @map("first_name") @db.VarChar(200)
email String @unique @db.VarChar(254)
phone String @db.VarChar(100)
dateOfBirth DateTime? @map("date_of_birth") @db.Date
Expand Down Expand Up @@ -558,7 +557,7 @@ enum SupportType {

enum MSRStatus {
registered
unsubscribed
unregistered

@@map("msr_status")
@@schema("msr")
Expand Down
Loading