Const
Adds a collection of create data entries to a database through a PrismaClient
instance.
This is particularly useful for setting up mocks in a mock PrismaClient.
import {addPrismaModelData} from '@augment-vir/common';
import {PrismaClient} from '@prisma/client';
await addPrismaModelData(new PrismaClient(), [
{
user: {
mockUser1: {
first_name: 'one',
id: 123,
// etc.
},
mockUser2: {
first_name: 'two',
id: 124,
authRole: 'user',
// etc.
},
},
},
{
region: [
{
id: 1,
name: 'North America',
// etc.
},
{
id: 2,
name: 'Europe',
// etc.
},
],
},
]);
Dump data from the current database through a PrismaClient
instance.
Runs Prisma generators included in the given Prisma schema (which usually includes the Prisma JS client). This will work even if the database doesn't exist yet.
Detects if the current generated Prisma JS Client was generated from the current Prisma schema.
List all model names in the given Prisma client.
Gets a string list of all differences between the current database and the Prisma schema that should control it.
Uses prisma.database.diff
to detect if there are any differences between the current
database and the Prisma schema that should control it.
Force resets a dev database to match the current Prisma schema and migrations.
This will destroy all data. Do not use in production.
Apply all migrations. Meant for a development environment, with less protections than
prisma.migration.applyProd()
Apply all migrations. Meant for a production environment.
Creates a new migration.
Get current migration status.
Centralized Prisma API from
@augment-vir/node
.Prisma flows
Deploy to production
prisma.migration.applyProd()
Update dev environment
Apply migrations:
prisma.migration.applyDev
prisma.migration.create
prisma.database.resetDev
Generate client:
prisma.client.isCurrent
false
, runprisma.client.generate