ygojson / ygojson-tools

Tooling for the ygojson project
MIT License
1 stars 0 forks source link

Add an option/tool to backup the running DB into a file #145

Open magicDGS opened 5 months ago

magicDGS commented 5 months ago

For debugging and development purposes, it would be nice to be able to create a dump of the running application DB as a sqlite file (requires #138). This can be done as following:

    @Inject
    DataSource dataSource;

    @Transactional
    void dump() throws SQLException {
        try (
            final Statement statement = dataSource.getConnection().createStatement()
        ) {
            statement.execute("backup to backup.db");
        }
    }

Where the file is called backup.db.

This can help us to explore the data during development to find possible improvements on normalization (even more if #139 is implemented)

magicDGS commented 4 months ago

Maybe instead of dump the database, it will be much better to directly use an in-disk one, so we can resume if there is a failure or upload to github-action results if there is a failure to investigate the state (mostly for debugging, so most likely not always).