Prisma: Prisma2 Multi-Tenant datamodel migration issue for postgres database.

Created on 19 Feb 2020  Â·  3Comments  Â·  Source: prisma/prisma

Description:

I've been trying the Prisma2 multi-tenant with postgres database, But after changing the datamodel
and executing prisma-multi-tenant migrate up command it shows ✅ Successfuly migrated up all tenants but datamodel changes are not getting migrated on postgres database.

Similar response for prisma-multi-tenant migrate db up -- --auto-approve and prisma-multi-tenant migrate db up commands datamodel changes are not getting migrated to postgres database.

Datamodel:

datasource tenant {
      provider = "postgresql"
      url      = env("PMT_URL")
}

datasource management {
      provider = "postgresql"
      url      = "postgresql://*****:*****@localhost:5432/management"
      enabled  = false
}

// End of prisma-multi-tenant

generator client {
    provider = "prisma-client-js"
}

model User {
      UserId      String   @default(cuid()) @id
      FirstName   String
      LastName    String?
      Address     String?
      Email       String?
      CompanyName String?
      NoOfUsers   String?
      ZipCode     String?
      Country     String?
      TestField   String?
      TestField2  String?
}

model App {
    id                String @default(cuid()) @id
    appId             String @default("") @unique
    name              String
    TestField         String?
}

Steps to reproduce the issue:

  1. First setup single tenant i.e. normal prisma2 datamodel by using prisma2 init command
  2. Provide the mandatory details like datasource url (postgres database url) and execute prisma2 migrate save --name "migration-name" --experimental and prisma2 migrate up --experimental commands respectively ( It will deploy changes to the postgres database )
    3.Initialize the multi-tenant using prisma-multi-tenant init command.
  3. After multi-tenant setup add or remove fields from datamodel and execute prisma-multi-tenant migrate up command. ( It shows datamodel changes successfully migrated, but it does not reflected in database ).

Actual Result:
After executing prisma-multi-tenant migrate up command it returns ✅ Successfuly migrated up all tenants, But datamodel changes does not get migrated on postgres database.

Expected Result:
After executing prisma-multi-tenant migrate up command for specific tenant or all tenant,
datamodel changes should reflect in actual database.

System:
prisma2: "^2.0.0-preview022"
prisma-multi-tenant:"^2.0.0-alpha21"
@prisma/client : "^2.0.0-preview022"

Most helpful comment

Yes, thank you @BjoernRave for pinging me!

@SameerChorge94 Can you move your issue to https://github.com/Errorname/prisma-multi-tenant so that I can take a look ? 🙂

All 3 comments

First up the prisma-multi-tenant library is not supported by the prisma team and still in the alpha phase.
@Errorname I think this is your domain

Yes, thank you @BjoernRave for pinging me!

@SameerChorge94 Can you move your issue to https://github.com/Errorname/prisma-multi-tenant so that I can take a look ? 🙂

Yes, thank you.

So closing this issue and moving to https://github.com/Errorname/prisma-multi-tenant/issues/21

Was this page helpful?
0 / 5 - 0 ratings

Related issues

znicholasbrown picture znicholasbrown  Â·  3Comments

steebchen picture steebchen  Â·  3Comments

renemonroy picture renemonroy  Â·  3Comments

divyenduz picture divyenduz  Â·  3Comments

janpio picture janpio  Â·  3Comments