feat(data-store): initialize DB using migrations #679
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #676
BREAKING CHANGES
The
@veramo/data-store
package relies ontypeorm
as a database abstraction.Typeorm has a connection flag
synchonize
which bootstraps the database along with schema and relations based on a set ofEntities
(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.
To adopt this, there are some small changes needed for your agent configuration:
new
@veramo/cli
configuration:If you're already running an agent using the
@veramo/cli
package, please update thedbConnection
section of your configuration like so:If you haven't edited your configuration before, you can simply create a new config file with the
veramo config create
command.new JS/TS configuration:
PR Tasks
querryRunner
APInullable: true
with respective Entity propertiesmigrations
and withsynchronize: true