Skip to content

Commit 072a53d

Browse files
authored
Merge pull request #1540 from visualize-admin/docs/vercel-dev-db
docs: Add bit on migrations & dev database
2 parents 051b459 + fd86f2f commit 072a53d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ yarn dev:rollup
9090
9191
#### Database migrations
9292

93-
Database migrations are run automatically when the _production_ app starts. In _development_, you'll have to run them manually:
93+
Database migrations are run automatically when a production build of the app starts. In _development_, you'll have to run them manually:
9494

9595
```sh
9696
yarn db:migrate:dev
@@ -100,6 +100,18 @@ Migrations are located in `db-migrations/`. Write SQL or JS migrations and follo
100100

101101
For detailed instructions, please refer to the [postgres-migrations](https://github.com/thomwright/postgres-migrations) documentation.
102102

103+
⚠️ On Vercel environments like "preview" and "production", "production" build are started which means that database migrations are executed.
104+
Since all environments are sharing the same database, it means that a database migration executing on 1 database could be disruptive to
105+
other preview deployments. For example adding a column to the schema would be disruptive, since other preview deployments would try to
106+
remove it (since the column is not yet in the schema). To prevent any problems on preview deployments, we have a second database that
107+
is special for development and that must be used if you are working on a branch that brings in database changes. You can configure
108+
this in the Vercel environment variables by copy-pasting the environment variables found in the [visualization-tool-postgres-dev][]
109+
storage (see `.env.local` tab), and copy paste them as [environment variables](https://vercel.com/ixt/visualization-tool/settings/environment-variables)
110+
in the visualisation-project. Take care of scoping the new environment variables to the preview branch you are working on.
111+
After merging the branch, you can delete the environment variables scoped to the branch.
112+
113+
[visualization-tool-postgres-dev](https://vercel.com/ixt/visualization-tool/stores/postgres/store_dV3rog1asOXO3BfC/data)
114+
103115
## Versioning
104116

105117
New versions of `package.json` are built on GitLab CI into a separate image that will be deployed to the integration env.

0 commit comments

Comments
 (0)