wavlake / catalog

2 stars 0 forks source link

Node.js CI

Install dependencies

npm install

Generate Prisma Client

npm run generate

Run the server in watch mode for development

npm run dev

Or, first build the app, and then run the server without watch mode

npm build
npm start

Running database migrations

Update migrations

npm run migrate

Run Prisma introspection of updated DB

npm run pull

Regenerate Prisma client

npm run generate

Rollback last migration

npm run rollback

NOTE: Do not use Prisma's migration utility to snapshot or create new migrations. We currently use knexjs to manage the database schema and other properties that currently is not possible using Prisma migrations (e.g. constraints, triggers, and views)

Creating a new database migration

If this is your first migration, install the migration cli

npm install knex -g

Change into the db directory

cd db

Create a new migration, choose a descriptive name for it

knex migrate:make adding_a_new_field_to_table

Open up the newly generated file, and edit it to meet your migration needs.

Save the file and then be sure to run npm run migrate to migrate your local db to the your new schema