Managing the schema and deployments with the command line tool
Signs in with the oneend CLI, links a folder to a project, then handles migrations, types and deployments.
Please help me manage this project with the command line tool (oneend).
1. Make a write token under Account, then API · MCP tokens (/account/tokens) in the console, and save it with oneend login --token <token>.
In CI, do not save it; pass it in the ONEEND_TOKEN environment variable.
2. In the app folder, link it with oneend link --project <ref>. Find the ref with oneend projects list (list_projects).
3. If the project already has tables, get the current schema as the first migration with oneend db pull.
This file is recorded as applied, so it is not run again (dump_schema, and record_only in apply_migrations).
4. Write changes as SQL in the file oneend migration new <name> makes, and apply them with oneend db push (apply_migrations).
oneend migration list (list_migrations) shows the difference between local and remote.
5. Make the types again with oneend gen types typescript > src/database.types.ts (generate_typescript_types).
6. Get the environment variables with oneend env pull, deploy with oneend deploy, and watch the build log to the end.
Put the access rules in the same migration that creates a new table. See blackwall://access-rules. The commands in detail are in blackwall://cli, and how migrations are applied is in blackwall://migrations.