mirror of
https://github.com/djdevin/recflare.git
synced 2026-10-27 16:08:58 -07:00
[studio] add missing migration script
This commit is contained in:
@@ -71,7 +71,7 @@ preview:
|
|||||||
deploy *args:
|
deploy *args:
|
||||||
bun turbo deploy "$@"
|
bun turbo deploy "$@"
|
||||||
|
|
||||||
# Apply D1 migrations (rooms + auth own them). Defaults to --remote; pass `-- --local`
|
# Apply D1 migrations (every worker with a `migrate` script). Defaults to --remote; pass `-- --local`
|
||||||
# for the dev db. Scope with -F, e.g. `just migrate -F rooms`.
|
# for the dev db. Scope with -F, e.g. `just migrate -F rooms`.
|
||||||
[group('2. local dev')]
|
[group('2. local dev')]
|
||||||
[positional-arguments]
|
[positional-arguments]
|
||||||
|
|||||||
@@ -34,3 +34,15 @@ pnpm test
|
|||||||
```sh
|
```sh
|
||||||
pnpm turbo deploy
|
pnpm turbo deploy
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Migrate
|
||||||
|
|
||||||
|
This worker owns `studio_cloud_build` and `studio_unity_asset_file` on the shared
|
||||||
|
`recflare` database (`migrations/`, tracked in its own `d1_migrations_studio` table).
|
||||||
|
Deploying does not apply them; the cdn worker reads `studio_unity_asset_file` and
|
||||||
|
answers 404 for every Studio bundle until this has run.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
just migrate -F studio # remote
|
||||||
|
just migrate -F studio -- --local # dev db
|
||||||
|
```
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"deploy": "run-wrangler-deploy",
|
"deploy": "run-wrangler-deploy",
|
||||||
"dev": "run-wrangler-dev",
|
"dev": "run-wrangler-dev",
|
||||||
"fix:workers-types": "run-wrangler-types",
|
"fix:workers-types": "run-wrangler-types",
|
||||||
|
"migrate": "run-wrangler-migrate",
|
||||||
"test": "run-vitest"
|
"test": "run-vitest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -6,14 +6,17 @@
|
|||||||
"compatibility_flags": ["nodejs_compat"],
|
"compatibility_flags": ["nodejs_compat"],
|
||||||
// Shared `recflare` D1. Room co-owners come off the `room` blob and who is in a
|
// Shared `recflare` D1. Room co-owners come off the `room` blob and who is in a
|
||||||
// subroom comes off `presence` (other workers own those tables). This worker
|
// subroom comes off `presence` (other workers own those tables). This worker
|
||||||
// owns the cloud-build tables, migrated from `migrations/`. The "local"
|
// owns the cloud-build tables, migrated from `migrations/`; its own
|
||||||
// placeholder is replaced with RECFLARE_D1 at deploy time.
|
// migrations_table keeps that history separate from the other workers'
|
||||||
|
// migrations on the shared database. The "local" placeholder is replaced with
|
||||||
|
// RECFLARE_D1 at deploy time.
|
||||||
"d1_databases": [
|
"d1_databases": [
|
||||||
{
|
{
|
||||||
"binding": "DB",
|
"binding": "DB",
|
||||||
"database_name": "recflare",
|
"database_name": "recflare",
|
||||||
"database_id": "local",
|
"database_id": "local",
|
||||||
"migrations_dir": "migrations"
|
"migrations_dir": "migrations",
|
||||||
|
"migrations_table": "d1_migrations_studio"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// Shared `recflare-cdn` R2 bucket (also bound by `rooms` / `cdn` / `storage`).
|
// Shared `recflare-cdn` R2 bucket (also bound by `rooms` / `cdn` / `storage`).
|
||||||
|
|||||||
Reference in New Issue
Block a user