@the-meridian/cli 1.0.2 → 1.0.3
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.
- package/CHANGELOG.md +6 -0
- package/README.md +21 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ meridian dev # every day
|
|
|
17
17
|
- Node.js 20 or newer
|
|
18
18
|
- A Meridian account with access to at least one organization and app
|
|
19
19
|
|
|
20
|
-
You do **not** need Docker, a local MySQL server, `gcloud`, or the Cloud SQL Auth Proxy
|
|
20
|
+
You do **not** need Docker, a local MySQL server, `gcloud`, or the Cloud SQL Auth Proxy. The CLI downloads and manages the proxy for you.
|
|
21
21
|
|
|
22
22
|
## How it works
|
|
23
23
|
|
|
@@ -144,7 +144,7 @@ SHADOW_DATABASE_URL="mysql://devu_88_15:<password>@127.0.0.1:3307/devdb_88_u15_s
|
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
- `SHADOW_DATABASE_URL` points at a second database provisioned for you, which `prisma migrate dev` needs (see below). It is reachable with the same credentials and is dropped when your dev database is.
|
|
147
|
-
- Every other line
|
|
147
|
+
- Every other line (comments, ordering, blank lines, quoting style) is preserved; only these two are replaced.
|
|
148
148
|
- The first time a file is modified, a one-time copy is saved as `.env.backup`, with the same permissions as the file it copies.
|
|
149
149
|
- An existing file keeps its permissions; a file the CLI creates is `0600`, because the line it writes contains a live password.
|
|
150
150
|
- The port changes between runs when the preferred port is busy, so re-running `meridian dev` rewrites the line.
|
|
@@ -167,13 +167,13 @@ datasource db {
|
|
|
167
167
|
|
|
168
168
|
`meridian migrate` offers to add the `shadowDatabaseUrl` line for you the first time it finds it missing, and writes it in place. It asks rather than just doing it, because a schema is source you keep in git, unlike the generated `.env`. A datasource that already names some other variable is left alone.
|
|
169
169
|
|
|
170
|
-
`shadowDatabaseUrl` is required because `prisma migrate dev` does not apply migrations directly: it replays your migration history into a throwaway shadow database and diffs that against your schema to detect drift. Prisma creates that database itself when it can, and your dev user cannot
|
|
170
|
+
`shadowDatabaseUrl` is required because `prisma migrate dev` does not apply migrations directly: it replays your migration history into a throwaway shadow database and diffs that against your schema to detect drift. Prisma creates that database itself when it can, and your dev user cannot: it holds privileges on its own two databases and nothing else, so `CREATE DATABASE` is denied and Prisma reports `P3014`. Meridian provisions the shadow database per developer instead of granting the privilege, because Prisma names shadow databases with a fixed `prisma_migrate_shadow_db_*` prefix: a grant broad enough to cover that would be shared by every developer on the instance.
|
|
171
171
|
|
|
172
172
|
Only `meridian migrate` needs it. `dev`, `db seed` and `db shell` run fine without it.
|
|
173
173
|
|
|
174
174
|
## Non-interactive and CI use
|
|
175
175
|
|
|
176
|
-
Prompts are skipped automatically when stdin/stderr aren't TTYs, when `CI` is set, or when `MERIDIAN_NON_INTERACTIVE` is set
|
|
176
|
+
Prompts are skipped automatically when stdin/stderr aren't TTYs, when `CI` is set, or when `MERIDIAN_NON_INTERACTIVE` is set. In that mode a command that would have prompted fails with a message naming the flag or variable to set instead.
|
|
177
177
|
|
|
178
178
|
| Variable | Purpose |
|
|
179
179
|
| --- | --- |
|
|
@@ -184,7 +184,7 @@ Prompts are skipped automatically when stdin/stderr aren't TTYs, when `CI` is se
|
|
|
184
184
|
| `MERIDIAN_NON_INTERACTIVE` | Same as `--no-input` |
|
|
185
185
|
| `MERIDIAN_NO_BROWSER` | Same as `login --no-browser` |
|
|
186
186
|
| `MERIDIAN_DEV_ACTIVE` | Set to `1` in every process `meridian dev` starts. Read it to detect that your script is already inside a session; setting it yourself makes `meridian dev` refuse to start |
|
|
187
|
-
| `MERIDIAN_DEV_DATABASE_ID` | Exported (alongside `DATABASE_URL`) into the children of `meridian dev`, `migrate` and `db …`, holding the id of the dev database that session provisioned. The Meridian SDK sends it as `devDatabaseId` on its identify call, so installs a locally-run app creates are billed to your dev database. Set by the CLI only
|
|
187
|
+
| `MERIDIAN_DEV_DATABASE_ID` | Exported (alongside `DATABASE_URL`) into the children of `meridian dev`, `migrate` and `db …`, holding the id of the dev database that session provisioned. The Meridian SDK sends it as `devDatabaseId` on its identify call, so installs a locally-run app creates are billed to your dev database. Set by the CLI only. Never set it yourself |
|
|
188
188
|
| `MERIDIAN_PROXY_PATH` | Use an existing proxy binary instead of downloading one |
|
|
189
189
|
| `MERIDIAN_PROXY_VERSION` | Pin a different proxy version (checksum is fetched from that release) |
|
|
190
190
|
| `MERIDIAN_PROXY_SKIP_CHECKSUM=1` | Allow install when no checksum is published. Use only if you trust the source |
|
|
@@ -198,39 +198,39 @@ Read commands support `--json`. Errors are also JSON in that mode:
|
|
|
198
198
|
|
|
199
199
|
## Troubleshooting
|
|
200
200
|
|
|
201
|
-
**`You are not logged in to Meridian
|
|
201
|
+
**`You are not logged in to Meridian.`**: Run `meridian login`.
|
|
202
202
|
|
|
203
|
-
**`This project is not linked to a Meridian app
|
|
203
|
+
**`This project is not linked to a Meridian app.`**: Run `meridian link` in the project root. The CLI looks for `.meridian/project.json` in the current directory and its parents.
|
|
204
204
|
|
|
205
|
-
**`Your Meridian CLI token is no longer valid (401)
|
|
205
|
+
**`Your Meridian CLI token is no longer valid (401).`**: The token was revoked or expired. Run `meridian login` again.
|
|
206
206
|
|
|
207
|
-
**`Provisioning the development database failed
|
|
207
|
+
**`Provisioning the development database failed.`**: Provisioning ended in an error state on Meridian's side; the reason the API reports is appended to the message. Check the dashboard for the full history, then re-run `meridian dev` to retry.
|
|
208
208
|
|
|
209
|
-
**`The development database is not ready yet
|
|
209
|
+
**`The development database is not ready yet.`**: A credentials or reset call arrived before provisioning finished (HTTP 409). `meridian dev` polls for you, so this normally only appears when a command runs against a database that is still being created.
|
|
210
210
|
|
|
211
|
-
**`Could not reach 127.0.0.1:<port>/<db> (ECONNREFUSED)
|
|
211
|
+
**`Could not reach 127.0.0.1:<port>/<db> (ECONNREFUSED).`**: Nothing is listening. `meridian dev` and `meridian migrate` start the proxy themselves; if you're running Prisma directly, keep `meridian dev` running in another terminal.
|
|
212
212
|
|
|
213
|
-
**`Timed out waiting for MySQL
|
|
213
|
+
**`Timed out waiting for MySQL …`**: The proxy is up but can't reach Cloud SQL. Check whether a VPN, firewall, or corporate proxy blocks outbound connections, then retry with `--verbose` to see the proxy's own logs.
|
|
214
214
|
|
|
215
|
-
**`Another process is already listening on that port
|
|
215
|
+
**`Another process is already listening on that port.`**: Pass `--port` to choose a different one.
|
|
216
216
|
|
|
217
|
-
**Proxy download fails** (air-gapped network, blocked storage.googleapis.com)
|
|
217
|
+
**Proxy download fails** (air-gapped network, blocked storage.googleapis.com): Install the [Cloud SQL Auth Proxy](https://github.com/GoogleCloudPlatform/cloud-sql-proxy) yourself and set `MERIDIAN_PROXY_PATH` to it.
|
|
218
218
|
|
|
219
|
-
**Checksum verification failed
|
|
219
|
+
**Checksum verification failed**: A cached binary that no longer matches its published SHA-256 is deleted and downloaded again automatically. If a fresh download also fails verification the CLI refuses to install it, which usually means something on the network is rewriting the response. Don't reach for `MERIDIAN_PROXY_SKIP_CHECKSUM` in that situation.
|
|
220
220
|
|
|
221
|
-
**A migration failed and left the schema half-applied
|
|
221
|
+
**A migration failed and left the schema half-applied**: `meridian migrate` restores the pre-migration snapshot automatically. To redo it by hand, use the newest file in `.meridian/snapshots/`, or run `meridian db reset` for a clean slate.
|
|
222
222
|
|
|
223
|
-
**The rollback itself failed
|
|
223
|
+
**The rollback itself failed**: Treat the database as unsafe: the reset succeeded but the replay didn't finish, so the schema is partial. Start the proxy with `meridian dev` in another terminal and replay the snapshot by hand (`mysql … < .meridian/snapshots/<timestamp>.sql`, or `meridian db shell` and paste it), or take the clean slate with `meridian db reset --migrate`. The failing statement's index is in the error message.
|
|
224
224
|
|
|
225
|
-
**`meridian dev` says it would call itself
|
|
225
|
+
**`meridian dev` says it would call itself**: Your `npm run dev` script invokes `meridian dev`. Point `dev_command` in `.meridian/project.json` at the real dev server (for example `next dev`), or run `meridian dev -- next dev`.
|
|
226
226
|
|
|
227
|
-
**"…would not touch the managed development database"
|
|
227
|
+
**"…would not touch the managed development database"**: Your Prisma datasource does not read `DATABASE_URL`, so Prisma would ignore the database the CLI just connected you to and use whatever the schema hardcodes (typically `file:dev.sqlite`). Set `provider = "mysql"` and `url = env("DATABASE_URL")`, and regenerate any migrations created for the old database, because their SQL is dialect-specific and MySQL will reject it. Projects that deliberately manage their datasource some other way can set `"skip_datasource_check": true` in `.meridian/project.json`.
|
|
228
228
|
|
|
229
|
-
**"written for a different database engine"
|
|
229
|
+
**"written for a different database engine"**: `migrate` screens `prisma/migrations` before it provisions anything, because a history generated for another engine cannot apply to MySQL. SQLite and Postgres quote identifiers as `"Session"`, which MySQL reads as a string literal, and SQLite's `TEXT` primary keys are invalid as MySQL keys. Migration SQL is dialect-specific, so the history has to be regenerated: if it has only ever run locally, delete `prisma/migrations` and re-run. This is the normal state of a Shopify app template, which ships SQLite migrations. `--allow-foreign-migrations` waives the check.
|
|
230
230
|
|
|
231
231
|
If an earlier attempt already failed against the database, run `meridian db reset` before retrying. Prisma records the failure in `_prisma_migrations`, and once the history is deleted that row names a migration that no longer exists on disk, which Prisma reports as drift and refuses to work past.
|
|
232
232
|
|
|
233
|
-
**"declares no `shadowDatabaseUrl`"**, or Prisma's **`P3014
|
|
233
|
+
**"declares no `shadowDatabaseUrl`"**, or Prisma's **`P3014`**: `prisma migrate dev` needs a shadow database and your dev user cannot create one. Meridian provisions it and exports `SHADOW_DATABASE_URL`; add `shadowDatabaseUrl = env("SHADOW_DATABASE_URL")` to your datasource. If you hit `P3014` despite having that line, your dev database predates shadow databases. `meridian db reset` re-provisions it.
|
|
234
234
|
|
|
235
235
|
## Development
|
|
236
236
|
|
package/package.json
CHANGED