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

Implement notebook that migrates database from schema v11.1.0 to v11.2.0 #813

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions db/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Database

This directory contains files related to the MongoDB database managed by the Runtime.

It has the following subdirectories:

- `./migrations`: files related to migrating the MongoDB database
3 changes: 3 additions & 0 deletions db/migrations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Migrations

This directory contains files related to migrating the MongoDB database between schemas.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pymongo.database import Database
from nmdc_schema.migrators.migrator_base import MigratorBase

from demo.metadata_migration.notebooks.bookkeeper import Bookkeeper, MigrationEvent
from db.migrations.notebooks.bookkeeper import Bookkeeper, MigrationEvent

# Consume environment variables.
MONGO_HOST: str = os.getenv("MONGO_HOST", "localhost")
Expand All @@ -36,7 +36,7 @@ class TestBookkeeper(unittest.TestCase):
Tests targeting the `Bookkeeper` class.

You can format this file like this:
$ python -m black demo/metadata_migration/notebooks/manual_test_bookkeeper.py
$ python -m black db/migrations/notebooks/manual_test_bookkeeper.py

You can start up a containerized MongoDB server like this:
$ docker run --rm --detach --name mongo-test-migration-bookkeeper -p 27017:27017 mongo
Expand All @@ -45,7 +45,7 @@ class TestBookkeeper(unittest.TestCase):
- host.docker.internal:27017

You can run these tests like this:
$ python -m unittest -v demo/metadata_migration/notebooks/manual_test_bookkeeper.py
$ python -m unittest -v db/migrations/notebooks/manual_test_bookkeeper.py

Reference: https://docs.python.org/3/library/unittest.html#basic-example
"""
Expand Down
Loading
Loading