summaryrefslogtreecommitdiff
path: root/database_test.go
AgeCommit message (Collapse)Author
2026-06-02Name tests like functions to testxengineering
This enforces a similar structure of test functions named `TestFooBar` if they test the function `FooBar`.
2026-06-02Add MigrateToLatestxengineering
This function will be used most by the production software to update the database schema to the latest known version.
2026-06-02Remove success logging in testsxengineering
In case the test succeeds it is not required to log anything. This only adds noise to the output.
2026-05-31Add UserVersion()xengineering
This function gets the user_version SQLite3 field describing which migration was the last executed one. A test checking this before applying any migrations and after each migration is included.
2026-05-31Add migration executionxengineering
This adds the execution of the embedded migrations and adds a suitable unit test.
2026-05-31Add migration readingxengineering
This prepares the infrastructure to place migration SQL code in the source repository with paths formatted as `sql/migrations/%04d.sqlite3`. The numbers need to be counting up from 1. They are embedded with Go's embed package and are parsed into a slice of strings where the migration number minus one is the slice index and the value is the migrations file as string. This makes handling of migrations in code as easy as possible. This commit adds also tests for this functionality.