Errorname / prisma-multi-tenant

🧭 Use Prisma as a multi-tenant provider for your application
MIT License
395 stars 45 forks source link

Prisma multi tenant does not create new schemas #34

Closed meherpanguluri closed 4 years ago

meherpanguluri commented 4 years ago

Hi, This is my .env in prisma

DATABASE_URL="postgresql://postgres:postgres@localhost:32769/tenant?schema=public" MANAGEMENT_PROVIDER=postgresql MANAGEMENT_URL=postgresql://postgres:postgres@localhost:32769/management

I have created two databases for management and tenants. I dont see any schemas created in the tenant database for new tenants. Not sure from the documentation if we need to create two databases?

Thanks

Errorname commented 4 years ago

Hi @meherpanguluri ! Did you follow the Getting Started guide? It should explain how to make it work.

In a few words:

If after following the Guide you still have questions, don't hesitate to ask them here 🙂

meherpanguluri commented 4 years ago

Yes I have followed the getting started guide I have used prisma-multi-tenant new to create a new tenant. I see tenant getting created on the management db but I dont see schema on tenant db.

Thanks

Errorname commented 4 years ago

Was there an error in the console when creating the new tenant? If not, can you make a small reproduction repository so that I can replicate the issue?

meherpanguluri commented 4 years ago

There is no error when creating a tenant.

? Name of the tenant: tenant2 ? Database provider: postgresql ? Database url: postgresql://postgres:postgres@localhost:32769/postgres

{ name: 'tenant2', provider: 'postgresql', url: 'postgresql://postgres:postgres@localhost:32769/postgres' }

? Are you sure of your inputs? Yes

✅ Registered the new tenant into management and migrated up the database!

Errorname commented 4 years ago

Can you try running prisma-multi-tenant new --verbose to have more informations on what the command did?

meherpanguluri commented 4 years ago

prisma-multi-tenant new --verbose

Warning: Prisma does not yet allow for multi-provider clients, so you must use the same provider used in your schema.prisma file.

? Name of the tenant: tenant1 ? Database provider: postgresql ? Database url: postgresql://postgres:postgres@localhost:32769/postgres

{ name: 'tenant1', provider: 'postgresql', url: 'postgresql://postgres:postgres@localhost:32769/postgres' }

? Are you sure of your inputs? Yes $> "/Users/dev/Desktop/test-prisma/node_modules/@prisma/cli/build/index.js" migrate up --create-db --experimental (node:11894) ExperimentalWarning: The fs.promises API is experimental

✅ Registered the new tenant into management and migrated up the database!

meherpanguluri commented 4 years ago

I see that the tenants are created in the management > tenant table.

Errorname commented 4 years ago

Hi @meherpanguluri ! I just released 2.0.0-beta.3. It may fix your issues. If not, can you create a github repository with a reproductible example of the issue ? Otherwise, I'm not able to reproduce and fix it

Errorname commented 4 years ago

Since there hasn't been activity on this issue for a while, I'll close it. Don't hesitate to reopen it if needed