Similar to configuration, from time to time, the GoCD database needs to be migrated as well, to accommodate new features or other changes. GoCD uses DBDeploy to perform this operation.
Explaining by example, I'll take the case of how the database migration 1701001 was added
~/projects/go$ ./gradlew server:createDbMigration -PmigrationName=remove_gadget_oauth_tables -q Creating new migration: ~/projects/go/server/db/migrate/h2deltas/1701001_remove_gadget_oauth_tables.sql
The above file will create a file with the following convention:
For example, for the first migration of 17.1 release, the migration was
~/projects/go$ touch ./server/db/migrate/h2deltas/1701001_remove_gadget_oauth_tables.sql
- 2-digit-major-release-version : 17
- 2-digit-minor-release-version : 01
- 3-digit-migration-sequence-number: 001
- description-of-the-migration: remove_gadget_oauth_tables
Following the DBDeploy semantics, the 1701001 migration was created as
DROP TABLE IF EXISTS gadgetOauthAuthorizationCodes; ... --//@UNDO CREATE TABLE gadgetOauthClients ( id BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1) PRIMARY KEY, oauthAuthorizeUrl VARCHAR(255) UNIQUE NOT NULL, clientId VARCHAR(255) NOT NULL, clientSecret VARCHAR(255) NOT NULL, serviceName VARCHAR(255) UNIQUE NOT NULL, );
If you now run
and then bring up a Development Server, you will see that the migration runs.