Documentation ¶
Overview ¶
package dbhelper implements functions to be able to easily create and modify database table structures without duplicating code.
Users of this package will define a set of migration functions which modify the database structure. The first migration will create the initial tables, the next ones will modify the tables. When the database migration function runs for the first time, it creates the database structure, on repeated runs, it will check if there are any migrations that should be ran and if they are there, runs them. This means that with one set of functions, we can initialize and migrate the database without any code duplication.
This package stores the database schema version in a table called _dbschema
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunDbVerMigrations ¶
migrations for the dbver number to be used in case migrations were used previously and the program is switching to use dbhelper which uses a different internal table and different indexing
func RunMigrations ¶
pass a list of functions that performs migrations, this package will find which ones are new by comparing the length of the migrations slice with the index of the migration that successfully ran last and run those that didn't run yet.
Types ¶
This section is empty.