mirror of
https://github.com/correl/mtgsqlive.git
synced 2024-11-22 03:00:10 +00:00
Add meta table
This commit is contained in:
parent
391ce43d90
commit
8f946d3d24
1 changed files with 6 additions and 0 deletions
|
@ -332,6 +332,11 @@ def generate_sql_schema(json_data: Dict,
|
|||
)
|
||||
|
||||
# add extra tables manually if necessary
|
||||
if version.startswith("5"):
|
||||
schema["meta"] = {
|
||||
"date": {"type": "DATE"},
|
||||
"version": {"type": "TEXT"},
|
||||
}
|
||||
if output_file["AllPrices.json"] or version.startswith("4"):
|
||||
schema["prices"] = {
|
||||
"uuid": { "type": "TEXT(36) REFERENCES cards(uuid) ON UPDATE CASCADE ON DELETE CASCADE" if engine == "sqlite" else "CHAR(36) NOT NULL,\n INDEX(uuid),\n FOREIGN KEY (uuid) REFERENCES cards(uuid) ON UPDATE CASCADE ON DELETE CASCADE" },
|
||||
|
@ -422,6 +427,7 @@ def parse_and_import_cards(
|
|||
"""
|
||||
LOGGER.info("Building sets")
|
||||
if "data" in json_data:
|
||||
sql_dict_insert(json_data["meta"], "meta", output_file)
|
||||
json_data = json_data["data"]
|
||||
for set_code, set_data in json_data.items():
|
||||
LOGGER.info(f"Inserting set row for {set_code}")
|
||||
|
|
Loading…
Reference in a new issue