Building SQL DDL
These folders contain the code for the different databases supported by CIHub.
They contain the SQL necessary to create the necessary tables and migrate between versions (IE the DDL).
This SQL is generated into a go file and included as part of the CIHub binary.
Making a changes to the database DDL
Any new changes to the database structure are always put into a new SQL file. Follow the naming scheme in the store/shared/migrate/<db>/files of the SQL files by incrementing the number file name and give it a good description of what changes are being made.
Changes will need to be implemented for all supported databases, making similar changes for eg Postgres and SQLite.
NB Any changes to the database structure will need to be reflected for the relevant struct in the core directory. Changing the objects in the store directory for the ORM.
Generating Go from the SQL files
To generate the go files you will need to install the golang command line tool Togo so it is on your users PATH.
Steps to install Togo
go install github.com/bradrydzewski/togo
Generating go DDL
Enter the desired database's implementation folder, and run the following. It will update the ddl_gen.go file.
go generate
If you have just, you can also use the command:
just generate