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

Migrate to Prisma ORM #837

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft

Migrate to Prisma ORM #837

wants to merge 15 commits into from

Conversation

tomitheninja
Copy link
Contributor

Closes #661

@tomitheninja
Copy link
Contributor Author

tomitheninja commented Aug 29, 2021

State report

  • database
    • db schema migration
    • db seeding
  • app
    • sch authentication
  • groups
    • create
    • copy
    • edit
    • delete
    • join
    • leave
    • lists all groups
    • all widget properties loaded (incl the link)
    • can list past events
    • pagination does not skip any group
    • pagination works with more than 5 pages
  • user profile
    • wantsEmail - both direction
    • floor - both direction
    • owned events are visible
    • joined events are visible
    • no other groups are visible
    • name and link works
  • tickets
    • creation
    • deletion
    • lists all tickets
  • rooms
    • show current status
    • heatmap
    • calendar
  • Admin rights
    • change role of user
    • change role of self. Check: is it allowed ???
    • shown to other users on profile
    • delete any group (incl owned)
    • edit any group
    • kick members
  • Ticket admin
    • visible on user profile by self
    • visible on user profile by others
    • can change ticket status
    • can delete tickets
    • can create tickets
  • optimized db queries
    • on /groups
    • on /rooms
    • on /tickets
    • on /users

@tomitheninja
Copy link
Contributor Author

Migration guide (without data loss)

Without backup and restore

step 1: Insert fake prisma migration logs

Migrate up using knex until 20210829032204_insert_mocked_prisma_migration_logs

You can do this by running yarn migrate:upgrade

step 2: Run prisma migrations

Run yarn prisma:migrate

This will only run migrations newer than 20210829032204_insert_mocked_prisma_migration_logs = 20210829032204_insert_mocked_prisma_migration_logs

With backup and restore

  • backup data from the db.
  • clean the database schema
  • hide migrations newer than 20210829032204
  • run prisma:migrate
  • restore data from the backup
  • restore all migrations
  • run prisma:migrate again

@@ -16,3 +16,6 @@ DB_PORT=5432
DB_USERNAME=tanulo
DB_PASSWORD=tanulo
DB_DATABASE=tanulo

# Don't touch this
DB_URL="postgresql://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}?schema=public"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

CI crashes, because this is missing.
Can we introduce a new env var, or I should copy this line into the CI config?

Copy link
Member

Choose a reason for hiding this comment

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

I think you'll have to add it to both .env and the CI configs, since we'll need it in both places (CI uses the vars defined in the yaml, while live env uses the .env file).

@tomitheninja tomitheninja self-assigned this Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to Prisma ORM
2 participants