-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
persistence directory migrations v4 for new deck configuration
- Loading branch information
1 parent
28fd16e
commit 4ebcade
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
robot-server/robot_server/persistence/_migrations/v3_to_v4.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,24 @@ | ||
"""Migrate the persistence directory from schema 3 to 4. | ||
Summary of changes from schema 3: | ||
- Deck Configuration now Supports the addition of Modules as Fixtures | ||
- Fixture items within the configuration have an optional Serial Number field | ||
- NOTE: Database has not changed, maintains form from v3 of SQLite schema | ||
- NOTE: Schema 3 is forward compatible with schema 4, so migration is a simple directory copy action | ||
""" | ||
|
||
from pathlib import Path | ||
import shutil | ||
from .._folder_migrator import Migration | ||
|
||
|
||
class Migration3To4(Migration): # noqa: D101 | ||
def migrate(self, source_dir: Path, dest_dir: Path) -> None: | ||
"""Migrate the persistence directory from schema 3 to 4.""" | ||
for item in source_dir.iterdir(): | ||
if item.is_dir(): | ||
shutil.copytree(src=item, dst=dest_dir) | ||
else: | ||
shutil.copy(src=item, dst=dest_dir) |
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