-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Added SQLite event store the ability to create connection #178
Added SQLite event store the ability to create connection #178
Conversation
Moved creation of db by location to construction
autoMigration?: 'None' | 'CreateOrUpdate'; | ||
}; | ||
}; | ||
export type SQLiteEventStoreOptions = |
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.
SUGGESTION: @davecosec can we also allow passing sqlite3.Database
? I think that will be useful to do without passing the sqliteConnection. I know that in the future we'll allow more providers, but for now we have only one, so I think that this would be accessible to add.
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.
@davecosec, that's good work. I added some small requests to adjust the database injection and lifetime management. Once that's made, I'm happy to pull that in.
Feel free to ask if I wasn't precise in the comments. 🙂
697ae3d
to
3eda928
Compare
} | ||
|
||
if (options?.databaseLocation == null) { | ||
throw new Error('Database location is not set'); |
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.
CONCERN: Wouldn't it be better to make database location required? Then, on the compiler level, we would make it impossible to provide the wrong value. The alternative is to keep it optional and use in-memory if not provided, which I think is fine.
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.
Added the fallback.
@davecosec could you check why this test is faling in CI?
|
acf1d20
to
a974b8e
Compare
E2E tests were failing, as there was no nested database folder in the 'testing' subdirectory. Probably locally it was created, but git is not commiting empty folders. Adjusted not to require such nesting. Fixed also TS config to compile SQLite package correctly, as some entries were missing. After that fixed the common errors. Added a helper withConnection to streamline the connection management. Now it also uses correctly close in finalize, instead of double closing in case of error. Renamed location to fileName to follow the SQLite naming convention, made it also optional with fallback to in memory. Removed absolute file path and custom, as it won't allow easily passing the filenames without casting that are not typed manually.
a974b8e
to
913f5e6
Compare
Moved creation of db by location to construction