migrations

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

Database Migrations

We use Atlas to generate migrations based on GORM's models.

How to generate a new migration

  • Update the DB models that you need
  • Run make generate-migrations, give a meaningful name to the migration (i.e. add-created-at-to-projects)
Resolving conflicts in migrations

In case there are migrations created on two different branches there would be a conflict which should be resolved.

The first branch merging to main should work fine. The second branch will have to rebase from main and run atlas migrate rebase <versions> from the problematic versions. Consult the Atlas documentation for further explanations.

Running migrations

if you set AK_DB__AUTO_MIGRATE=true then migrations will run automatically on the first time you start the server.

Otherwise, starting the server will fail if there are pending migrations, so you should run ak server migrate explicitly to run them.

CI Verification

On each PR where the GORM scheme file was changed, a CI job will run to verify the migration files are synced to the GORM model. If the files are synced, the job will pass, otherwise the job will fail and the developer has to generate the relevant migrations and add them to the PR.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Migrations embed.FS

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL