-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7606 from drew2a/feature/tribler.db
Migrate `knowledge.db` to `tribler.db`
- Loading branch information
Showing
52 changed files
with
723 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
23 changes: 23 additions & 0 deletions
23
src/tribler/core/components/database/database_component.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from tribler.core.components.component import Component | ||
from tribler.core.components.database.db.tribler_database import TriblerDatabase | ||
from tribler.core.utilities.simpledefs import STATEDIR_DB_DIR | ||
|
||
|
||
class DatabaseComponent(Component): | ||
tribler_should_stop_on_component_error = True | ||
|
||
db: TriblerDatabase = None | ||
|
||
async def run(self): | ||
await super().run() | ||
|
||
db_path = self.session.config.state_dir / STATEDIR_DB_DIR / "tribler.db" | ||
if self.session.config.gui_test_mode: | ||
db_path = ":memory:" | ||
|
||
self.db = TriblerDatabase(str(db_path), create_tables=True) | ||
|
||
async def shutdown(self): | ||
await super().shutdown() | ||
if self.db: | ||
self.db.shutdown() |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.