Skip to main content

Manage database migrations

Create and apply database schema changes across environments. GDI uses different migration tools depending on the component.

In this guide

Flyway migrations (DDS/AMS)
CKAN migrations
CKAN labels

Flyway migrations (DDS/AMS)

Create migration in src/main/resources/db/migration/:

-- V1__create_examples_table.sql
CREATE TABLE examples (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Flyway applies migrations automatically on startup, or run manually via:

./mvnw flyway:migrate

CKAN migrations

See CKAN documentation for Alembic migrations.

CKAN labels

CKAN labels use a versioned migration system for managing term translations in the term_translation table.

The extension stores migrations in ckanext/gdi_userportal/migrations/versions/ and runs them automatically on container startup.

Check migration status:

ckan gdi-userportal translations status

Run migrations manually:

ckan gdi-userportal translations migrate

For detailed documentation, see term_translation_migrations.md in the gdi-userportal-ckanext-gdi-userportal repository.