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.
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
feat: persisting the database #158
base: develop
Are you sure you want to change the base?
feat: persisting the database #158
Changes from all commits
752de20
2b5644c
cf48473
a90ffe8
4aebe6c
3deebd8
c811785
d74f680
7303dac
ec8c40e
bc8695d
39c098a
ddc787d
ce5b062
157d938
d4ccf36
8fa1e3e
8639fda
792c0a8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@artursudnik why is this step necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jrhender Because during development we usually execute the service with
DB_SYNC_SCHEMA_ON_START=true
and before generating a new migration we need to recreate the schema to be in sync with existing migrations only. Then, TypeORM is able to calculate the delta between modified entities and the schema defined before.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation, I know that isn't the first time you've explained it to me 😅
Maybe we can add the explanation to the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above - ideally to configure by
.env
and have singlemigration:generate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this was the first approach, but after exercising the creation of migrations a few times, I created two migration scripts in the
package.json
because when generating migrations, it is necessary to execute both for Postgres and SQLite one after another. Editing.env
every time would be really annoying and prone to mistakes. :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you give an example for such scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Postgres and SQLite are different DB engines, so migration files are different for them. If we want SSI to be able to use any of them, we need to provide migrations for both of them that differ. So, when DB schema is extended during development, it is necessary to generate a new migration file for Postgres and SQLite. It is not possible to execute Postgres migration on SQLite SQLite migration on Postgres.