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

refactor: Initialize database in constructor #211

Merged
merged 2 commits into from
Feb 14, 2022

Conversation

AndrewSisley
Copy link
Contributor

Closes #156

Makes it much harder to forget to initialize database (lots of functionality can partially work without doing so, leading to failures being detected later than need be - such as not loading existing schemas)

Makes it much harder to forget to initialize database (lots of functionality can partially work without doing so, leading to failures being detected later than need be)
@AndrewSisley AndrewSisley added the area/db-system Related to the core system related components of the DB label Feb 14, 2022
@AndrewSisley AndrewSisley self-assigned this Feb 14, 2022
@codecov
Copy link

codecov bot commented Feb 14, 2022

Codecov Report

Merging #211 (3a5be62) into develop (b93bafe) will increase coverage by 0.12%.
The diff coverage is 40.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #211      +/-   ##
===========================================
+ Coverage    57.42%   57.54%   +0.12%     
===========================================
  Files           98       98              
  Lines         9616     9613       -3     
===========================================
+ Hits          5522     5532      +10     
+ Misses        3479     3460      -19     
- Partials       615      621       +6     
Impacted Files Coverage Δ
bench/bench_util.go 9.23% <0.00%> (ø)
bench/storage/utils.go 0.00% <0.00%> (ø)
db/db.go 54.47% <57.14%> (+11.61%) ⬆️
db/tests/utils.go 58.76% <72.72%> (ø)
datastores/badger/v3/iterator.go 53.33% <0.00%> (-1.82%) ⬇️

Copy link
Member

@jsimnz jsimnz left a comment

Choose a reason for hiding this comment

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

LGTM

@AndrewSisley AndrewSisley merged commit 8511a1c into develop Feb 14, 2022
@AndrewSisley AndrewSisley deleted the sisley/refactor/I156-db-init branch February 14, 2022 20:56
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
* Explicitly return nil in case of no error

Is more obvious

* Initialize database in constructor

Makes it much harder to forget to initialize database (lots of functionality can partially work without doing so, leading to failures being detected later than need be)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/db-system Related to the core system related components of the DB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Defra will not load saved schema if Initialize is/was never called
2 participants