Hash signatures shall be checked on `migrate` call
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- postgresql, typescript
- Área
- databases
Línea de trabajo
Comienza rastreando el comando migrate y las comprobaciones de hash relacionadas con la tabla graphile_migrate.migrations. Reproduce el escenario de branch-1 y branch-2 descrito en el issue y, a continuación, verifica que migrate informe de una discrepancia cuando los archivos de migración existentes difieran de los hashes almacenados, manteniendo el comportamiento actual cuando coinciden.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Feature description
This is mostly a repeat of what was described in Discord chat, but duplicating here as well for better readability.
Currently, when migrate command is executed, it only checks hashes on the level of database constraint whenever a new migration is applied. But some cases might benefit from comparing existing migration file hashes against hashes stored in database.
Motivating example
Let's say that we have a project with 15 migration files. This state is in branch-1
Now, a refactoring change arrived and we decided to pretty-up existing migration files by combining and re-generating them. We combine some migrations, resulting in 10 different migration files, drop the old database and re-create the database with new migrations. The resulting schema is still the same, we are just using different migration files. Let's say this state is in branch-2.
If we have branch-1 checked out with 15 original migrations applied, switch to branch-2, and run migrate (without running db-reset beforehand) - we get Already up to date message and no errors.
The way I see it, it happens because we have 15 migrations applied, and migrate command cannot find 16-th migration to apply, thinking that all is good.
I would have expected to get an error, stating that there is some sort of mismatch between hashes that are stored in graphile_migrate.migrations table and the files that migrate command uses, but we get no errors.
I could have argued about this, that perhaps this can be checked explicitly by the calling code before migrate command is called, but a reversed case actually does what I would expect.
If we have branch-2 checked out with 10 migrations applied, and switch to branch-1 and try to run migrate command - we get an error insert or update on table "migrations" violates foreign key constraint "migrations_previous_hash_fkey", because migration 11 apply attempt fails because of mismatched hash.
Context of our case: we execute migrate from the code on app startup. During deployment, it was expected for service to fail to start, giving an indication that migrations are wrong... but it started and worked fine 🙂
Supporting development
I [tick all that apply]:
- am interested in building this feature myself
- am interested in collaborating on building this feature
- am willing to help testing this feature before it's released
- am willing to write a test-driven test suite for this feature (before it exists)
- am a Graphile sponsor ❤️
- have an active support or consultancy contract with Graphile
- Lenguaje dominante
- TypeScript
- Estrellas
- 836
- Forks
- 71
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de graphile/migrate
-
Partition migrations folderAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
-
🐛 bug
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
Todos los issues de graphile/migrate
Issues similares
-
foreground-up-signals-live: delivery-repair cell expects a spawn suggestion status no longer printsAbiertobug triage:owned
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
e2e-failure ready-to-code
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
redhat-developer/rhdh-plugin-export-overlays#4905 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
directus/directus#28558 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
review: medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
1lck/Lithe-IDEA#2432 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
cloudflare/workers-sdk#17189 ·
Los mantenedores suelen responder en 1 día