Skip to content

Create database template for new projects #1920

@hahn-kev

Description

@hahn-kev

Describe the feature
We want to be able to create new projects, which include all the seeded data from the fwdata template project. The template will be stored in our repo as a sql file, which when a new project is created the sql file will be applied to the database.

How the template will be created:

  1. Create a new FW project (maybe we can open the template directly?)
  2. Import that FW Project into a new empty crdt database (alternatively the database could be created from the previous template, and the FW project is synced in, but I'm not sure there's a benefit and it might have other problems)
  3. delete the ProjectData row (if it was ever created)
  4. delete all Writing systems, and Purge their commits and changes, might be easier to modify the import to just exclude writing systems
  5. from a shell run sqlite3 .\Example-Project.sqlite ".dump" > template.sql we now have a sql file which can be applied to a database to spin it up very quickly.

Note

This could happen in CI or we could just manually run the script to update the template from time to time, I'm not sure what's best here, FieldWorks does sometimes update their template, so we would want to try and keep in sync with that.

How the template will be used when creating a new project

  1. run cat template.sql | sqlite newProject.sql to create the database
  2. Generate and insert a new ProjectData row
  3. change the commit ClientId to match the client ID generated for the project data row. Something like update Commits set ClientId = 'newid', we do this so that the same ClientId isn't matched across all databases, though it's possible this is actually desirable.
  4. do the rest of the project setup, eg create writing systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    💻 FW Liteissues related to the fw lite application, not miniLcm or crdt related📖 MiniLcmissues related to miniLcm library code, includes fwdat bridge and lcmCrdt

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions