Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended User schema #1539

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ yarn dev:rollup

#### Database migrations

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

```sh
yarn db:migrate:dev
Expand All @@ -94,6 +94,18 @@ Migrations are located in `db-migrations/`. Write SQL or JS migrations and follo

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

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

[visualization-tool-postgres-dev](https://vercel.com/ixt/visualization-tool/stores/postgres/store_dV3rog1asOXO3BfC/data)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this in the README @bprusinowski


## Versioning

New versions of `package.json` are built on GitLab CI into a separate image that will be deployed to the integration env.
Expand Down
4 changes: 4 additions & 0 deletions app/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ model User {
id Int @id @default(autoincrement())
sub String? @unique @db.VarChar(64)
name String? @db.VarChar(100)
last_login DateTime? @db.Timestamp(6)
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime @default(now()) @db.Timestamp(6)

Config Config[] @relation()

@@map("users")
Expand Down
Loading