flyinggrizzly / plamotracker2

An app for tracking plastic models
GNU Affero General Public License v3.0
0 stars 0 forks source link

Figure out workflow for maintenace of data over time #2

Open flyinggrizzly opened 1 year ago

flyinggrizzly commented 1 year ago

Assumption: non-persistent database (e.g. disposable SQLite databases).

Requirements:

Considerations

Adding unique handles to all records will make this workable across databases without having to codify the database ID as an intrinsic model attribute (e.g. we can let it just be an implementation detail of the application). In many cases, this can be the name of the record, or the slug, in the case of KitLine and SourceMaterial. Ideally, it aligns with the easiest way for a human to consider and communicate about the record as well.

In theory, it should be easy for users to modify their tables in, for example, JSON, while the app is "offline", and have that cleanly translate to model records. For example, if I were to add a Kit via JSON

kits: [
  // other pre-existing kits
  {
    "name": "ReGZ [Unicorn Version]",
    "scale": "1/100",
    "kit_lines": ["mg"],
    "producers": ["Bandai"],
    "source_materials": [
      "gundam/cca",
      "gundam/uc"
    ]
  }
]

I should be able to expect that to be equivalent to running up the console and entering something like

Kit.create(
  name: "ReGZ [Unicorn Version]" ,
  scale: KitScale.find_by(denominator: 100),
  kit_lines: KitLine.find_by(slug: "mg"),
  producers: [ Producer.find_by(name: "Bandai") ],
  source_materials: [
    SourceMaterial.find_by(slug: "gundam/cca"),
    SourceMaterial.find_by(slug: "gundam/uc"),
  ]
)
flyinggrizzly commented 1 year ago

There should probably be a parallel process for updating fact tables, though ideally that ends up as PRs against the repo