@shophost/rest-api 2.0.24 → 2.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +21 -6
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -44,12 +44,16 @@ import { ManufacturerSchema } from "@shophost/rest-api/schemas";
44
44
 
45
45
  ## Database Schema Sync
46
46
 
47
- The published package now includes a small CLI so a fresh project can push the packaged Prisma schema to its own database.
47
+ The published package includes a CLI so a fresh project can push the packaged Prisma schema to its own database without copying `schema.prisma` into the app.
48
48
 
49
- 1. Set one of these environment variables in your app shell, `.env`, or `.env.local`:
50
- - `DATABASE_URL`
49
+ 1. Add your database URL to one of these places in the consuming app:
50
+ - `.env.local`
51
+ - `.env`
52
+ - the shell environment
53
+ 2. Use one of these variables:
51
54
  - `POSTGRES_PRISMA_URL`
52
- 2. Run:
55
+ - `DATABASE_URL`
56
+ 3. Run:
53
57
 
54
58
  ```bash
55
59
  pnpm exec shophost-rest-api db push
@@ -57,14 +61,25 @@ pnpm exec shophost-rest-api db push
57
61
  npx shophost-rest-api db push
58
62
  ```
59
63
 
64
+ Example:
65
+
66
+ ```env
67
+ # .env.local
68
+ POSTGRES_PRISMA_URL=postgresql://user:password@host:5432/dbname?sslmode=require
69
+ ```
70
+
60
71
  You can pass regular Prisma `db push` flags through as well:
61
72
 
62
73
  ```bash
63
74
  pnpm exec shophost-rest-api db push --accept-data-loss
64
- pnpm exec shophost-rest-api db push --url "postgres://..."
75
+ pnpm exec shophost-rest-api db push --url "postgresql://user:password@host:5432/dbname?sslmode=require"
65
76
  ```
66
77
 
67
- The CLI uses the `schema.prisma` and `prisma.config.ts` that ship with `@shophost/rest-api`, so consumers do not need to copy the schema into their own project first.
78
+ Notes:
79
+
80
+ - `.env.local` overrides `.env`
81
+ - `POSTGRES_PRISMA_URL` takes precedence over `DATABASE_URL`
82
+ - the CLI uses the `schema.prisma` and `prisma.config.ts` shipped inside `@shophost/rest-api`
68
83
 
69
84
  ## Development
70
85
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shophost/rest-api",
3
- "version": "2.0.24",
3
+ "version": "2.0.26",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "shophost-rest-api": "./scripts/shophost-rest-api.mjs"