Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add database migrations #125

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

kairoaraujo
Copy link
Collaborator

@kairoaraujo kairoaraujo commented Dec 14, 2023

This commit implements the database migrations.
The database migrations bring more consistency to the user on the deployment as Archivista will handle changes on the SQL Schema.

The implementation uses the Versioned Migrations.
The main reason is that the ent Offline Mode, which seems safer, is migrating to Versioned Migrations.

The proposal strategy is to run the migrations during the container start and fail early in case of issues before the archivista application is done in the entry point.

During the development, the developers can generate a new migration using the make db-migrations if there are changes in the schema files.

This commit also implements an automatic check to avoid it for code review. It was added to checks (db-migrations.yml)

@kairoaraujo kairoaraujo force-pushed the add_db_migrations branch 2 times, most recently from 1f3d5eb to 26a37a6 Compare December 14, 2023 19:23
This commit implements the database migrations.
The database migrations bring more consistency to the user on the
deployment as Archivista will handle changes on the SQL Schema.

The implementation uses the Versioned Migrations
(https://entgo.io/docs/versioned-migrations/).
The main reason is that the ent Offline Mode
(https://entgo.io/docs/migrate#offline-mode), which seems safer,
is migrating to Versioned Migrations.

The proposal strategy is to run the migrations during the
container start and fail early in case of issues before the
archivista application is done in the entry point.

During the development, the developers can generate a new migration
using the `make db-migrations` if there are changes in the schema
files.

This commit also implements an automatic check to avoid it for code
review. It was added to checks (`db-migrations.yml`)

Signed-off-by: Kairo de Araujo <kairo.araujo@testifysec.com>
Copy link
Member

@mikhailswift mikhailswift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pulled this and test locally, all works. also tested adding a new column to a schema to ensure a new migration gets generated and it does! great work

@kairoaraujo kairoaraujo merged commit e27a40f into in-toto:main Dec 19, 2023
11 checks passed
@kairoaraujo kairoaraujo mentioned this pull request Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants