The backend utilizes Prisma ORM, and it is responsible for all the database schema and changes. It is strongly recommended that all migrations be done using \`prisma migrate\` command, and not directly to the database.
Peform these tests before attempting production migration:
1. Run migration on last production seeded data
2. Run migration on dataset resembling production
3. Run npx prisma migrate dev to ensure no differences are detected after a test migration
4. Run npx prisma migrate reset then migrate dev to double check no differences are detcted
Before making any schema changes, make sure to back up the database manually once, just to be in the safe area.
To back up the database, first add the Connection URL of the production DB as the \`DATABASE_URL\` value in your local .env file.
Once that’s done, make sure you’re on the \`production\` branch, and run \`npx prisma migrate status\`. Make sure that only the migrations that you want to apply are showing up. After you’re sure that those are the migrations that are supposed to be applied, go ahead and run \`npx prisma migrate deploy\` command.
**IMPORTANT**: Make sure to not run any commands such as \`push\` or \`reset\` while the production DB is active. Always take the live DB connection string off once you’re done with the migration