refactor/recipe-to-snake-case (#364)

* formatting

* snake case all recipes entries

* set foreign key to int

* run scheduler at startup and not import

* set SQLite file path before imports

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden
2021-04-28 21:17:49 -08:00
committed by GitHub
parent ee445e7f54
commit 61e0a52100
19 changed files with 107 additions and 104 deletions

View File

@@ -83,7 +83,7 @@ class ImportDatabase:
del recipe_dict["categories"]
try:
del recipe_dict["_id"]
del recipe_dict["dateAdded"]
del recipe_dict["date_added"]
except:
pass
# Migration from list to Object Type Data

View File

@@ -144,7 +144,7 @@ class MigrationBase(BaseModel):
"""Calls the rewrite_alias function and the Cleaner.clean function on a
dictionary and returns the result unpacked into a Recipe object"""
recipe_dict = self.rewrite_alias(recipe_dict)
recipe_dict = Cleaner.clean(recipe_dict, url=recipe_dict.get("orgURL", None))
recipe_dict = Cleaner.clean(recipe_dict, url=recipe_dict.get("org_url", None))
return Recipe(**recipe_dict)

View File

@@ -37,7 +37,7 @@ class NextcloudDir:
class NextcloudMigration(MigrationBase):
key_aliases: Optional[list[MigrationAlias]] = [
MigrationAlias(key="tags", alias="keywords", func=helpers.split_by_comma),
MigrationAlias(key="orgURL", alias="url", func=None),
MigrationAlias(key="org_url", alias="url", func=None),
]