Tools
Environments
One application usually has more than one Rezin Core project: one to develop against, perhaps one to preview, and one for real users. Each is a full project with its own database, keys, accounts and files. Naming them as environments of the same application lets the console and the rezin tool treat them as a set.
Name a project's environment
In the console, open the project and go to Connect → Assistants and approvals → Environment.
| Field | Example | |
|---|---|---|
| Environment | development, preview, production | Lower-case letters, digits and hyphens |
| Application | shop | The same word on every project of the set |
A company can have one project for each environment of an application. The page then lists the other environments of the same application.
Only an owner of the company can change this.
Production
Marking a project as production is separate from its environment's name, and is the switch that matters for safety:
- A connected assistant or a token reaches it only if its owner ticked "May reach production projects".
- What an assistant asks to change there waits for an owner to approve.
See Safety for connected assistants.
With the command-line tool
rezin init creates one project for each environment of an application and names them for you. See the Expo quickstart and the others. It records which project is which in rezin/config.json in your application's folder. From that folder:
rezin env list # the environments and their projects
rezin env push development # apply the migrations in rezin/migrations not yet applied there
rezin env push --all # every environment, in turn
rezin env diff development production # what differs: tables, columns, rules, migrations
- **
push** applies each.sqlfile once, in name order, each in one transaction. It stops at the first that fails. - **
diff** prints what exists in only one of the two, and ends with status 1 when they differ, so a script can check before a release. - A migration written for one environment works in all of them as long as it does not name the project. To name the application's database role, build it from the schema, as the starter migration does:
current_schema() || '_app'.
rezin projects shows each project's application and environment.
A production project, once marked, needs a token that was allowed to reach production. Through the rezin tool a person's migration runs; through an assistant it waits for approval.