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

change to true DB migration (away from synchronize that breaks in production) #676

Closed
mirceanis opened this issue Aug 24, 2021 · 0 comments · Fixed by #679
Closed

change to true DB migration (away from synchronize that breaks in production) #676

mirceanis opened this issue Aug 24, 2021 · 0 comments · Fixed by #679
Assignees

Comments

@mirceanis
Copy link
Member

@trentlarson commented on Mon Apr 26 2021

See 'synchronize' explanation here: https://github.com/typeorm/typeorm/blob/master/docs/connection-options.md

Everything else appears to work in real apps (as long as #480 is included for mobile), so adding this will save people heartburn as they create their apps.


@mirceanis commented on Thu Apr 29 2021

This is very interesting. My gut tells me that this migration logic should be part of the @veramo/data-store plugin directly. What are your thoughts about this?


@mirceanis commented on Thu Jul 01 2021

@simonas-notcat perhaps you can share some wisdom here :)


@mirceanis commented on Fri Aug 20 2021

taking initial steps to promote migrations instead of synchronized: #661

@mirceanis mirceanis self-assigned this Aug 25, 2021
mirceanis added a commit that referenced this issue Aug 31, 2021
* feat(data-store): initialize DB using migrations
* fix(data-store): align onDelete cascade settings and do some decoupling of tests
* test(data-store): use multiple DB connection options in tests
* test(ci): use postgres in CI tests

fixes #676

BREAKING CHANGE: database needs migrations for initialization. See #679 #676
The `@veramo/data-store` package relies on `typeorm` as a database abstraction.
Typeorm has a connection flag `synchonize` which bootstraps the database along with schema and relations based on a set of `Entities` (annotated typescript classes).
This is very handy for fast development iterations but it is **not recommended for production** use because there is too much ambiguity possible when the `Entities` change, and there is a risk of data loss.
The recommended way to do things is to use the `migrations` mechanism. It allows you to migrate to new database schemas when necessary, and even customize the database to your own needs.

**Going forward, this is the mechanism we will be recommending for connections.**
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 a pull request may close this issue.

1 participant