#Database production migration

2 messages · Page 1 of 1 (latest)

knotty shoal
#

I have a mysql database in production, for the readability of the project the names of certain tables have changed. So I migrated it locally to be able to put it in my production environment. If I run the prisma migrate deploy command I'll lose all my data ?

If so, how can I avoid losing the data?

This is the message error when i run prisma migrate deploy :

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 is the best way to update the database without losing the data?

deep charm
#

Hi @knotty shoal

To avoid losing data and to inform Prisma Migrate about the current state of your production database, you need to baseline your database. Baselining is a process that initializes a migration history for a database that already exists and contains data that must be maintained. Can you please check the guide on baselining

Prisma

How to initialize a migration history for an existing database that contains important data.