Can't add prisma to Existing database - prisma

I am connecting my existing database to Prisma. I am followed the documentation (https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project/relational-databases/baseline-your-database-typescript-sqlserver). But the baseline step is throwing an error that is given below,
the command I tried is "npx prisma migrate resolve --applied 0_init". Anybody have the same issue?

Related

Getting error while connecting dbt with postgres

I'm trying to connect my dbt project with postgres db.
I'm writing all the connecting credentials in profiles.yml but it is throwing below error when i am running dbt debug.
dbt was unable to connect to the specified database.
The database returned the following error:
type object 'PostgresConnectionManager' has no attribute 'retry_connection'
I'm unable to find solution anywhere.
dbt-core v1.2.0 has added retry_connection method in BaseConnectionManager to support the retry connection feature. If the adapter implements this method, it can't run on dbt-core v1.1.0. Try updating the adapter.

Prisma migration error: The database schema is not empty

I have a prisma db and I am trying to run the deploy command for production.
When running yarn rw prisma migrate deploy , I get an error saying:
1 migration found in prisma/migrations
Error: P3005
The database schema is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline
What am I doing wrong and how can I fix it?
If you setted up Prisma on an existing database you must skip initial migration as such:
yarn prisma migrate resolve --applied <migration_name>
Its called baselining.
If it doesnt work due to some existing data, you can either rollback changes or fix the data problem and apply a fix with yarn prisma migrate diff
Details are here.
I ran the diff and applied the resulting file as such:
yarn prisma migrate diff --from-url <DATABASE_URL_PROD> --to-schema-datamodel <path to schema.prisma> --script > forward.sql
yarn prisma db execute --url <DATABASE_URL_PROD> --file forward.sql

Adding mongodb as target db postgress bucardo

i'm trying to set up bucardo postgres mongo replication but an facing error below when adding target db.
bucardo add db mongot dbname=mongo type=mongo host=XXX.XXX.XX.XX
Connection to "datasubmission" (MongoDB) failed. You may force add it with the --force argument. Error was: Can't locate object method "new" via package "MongoDB::Connection" (perhaps you forgot to load "MongoDB::Connection"?) at /usr/local/bin/bucardo line 1914.
how can I go about it?

Prisma migration fail with supabase

I'm trying to generate some migrations using Prisma.
I'm using Supabase which is using Postgres under the hood.
Also, I tried to run the following command with the local emulator and with the "real project".
When I run prisma db push it's working, so the communication between prisma and supabase can be established.
But when I try to run prisma migrate dev I get the following error
Error: db error: ERROR: no such database: prisma_migrate_shadow_db_b2ce3e4e-c5ef-41f6-830f-2203a082f1db
0: sql_migration_connector::flavour::postgres::sql_schema_from_migration_history
at migration-engine/connectors/sql-migration-connector/src/flavour/postgres.rs:367
1: migration_core::api::DevDiagnostic
at migration-engine/core/src/api.rs:108
Supabase CLI : 0.15.3
Prisma : 3.6.0
I also asked this question on Prisma repo : https://github.com/prisma/prisma/issues/10575
The solution is to create a shadow database as mentionned in the documentation
https://www.prisma.io/docs/concepts/components/prisma-migrate/shadow-database#cloud-hosted-shadow-databases-must-be-created-manually
Prisma
Prisma will try to drop the db during the migration and SupaBase doesn't like that so Prisma requires you to make a "Shadow Database"
Prisma Docs: Shadow Databases
SupaBase
To create the shadow db and get its connection string you have to connect to the SupaBase db with psql, create a new database and modify your connection string to point to the new db. (because prisma IS allowed to delete this second db during migration)
SupaBase Docs: Prisma (Shadow db)

Database Exception: Command `pg_restore` not found with odoo9

While,Trying to restore database form database manager then getting this error.
In my case, I able to solve this issue just adding a config setting in openerp-server.conf
file pg_path=C:/Program Files/PostgreSQL/9.6/bin