Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add feature to undo "grouped" migrations (applied with the same command) with only one command

Aperta
#1,264 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, node.js
Ambito
cli, database

Direzione di ricerca

Start by tracing the Sequelize CLI migrate and undo commands and how the sequelizemeta table records applied migrations. Define the behavior for grouping migrations from one command, including rollback order and metadata handling; done means a command can undo exactly the latest migration group. No files or tests are named, so repository exploration is required.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hello,
I am self-taught in DataBase management and usage. First I was using no tools to interface my program to the DB. I was writing all manualy. Next I have used the interface of Laravel in PHP ("Eloquent"). Now, I use Sequelize in my NodeJS project.

I have not found any information about my followinf suggestion but if it's already addressed, please just tell me.

I suggest to add a feature for migration to the sequelize CLI and maybe also to ohter sequelize parts (I don't knw how you are managing migration).
I suggest to add the possibility to undo all migration that are apply by the same command (like in Laravel Eloquent).

For exemple, If there are 5 migration applied and 3 pending migration. When you execute the migrate command, Sequelize will migrate the 3 pending migration. If you want to revert it, you have to undo 3 time or precize the migration name. I propose to add a command (maybe "db:migrate:undo:group") to automaticaly revert migrations that was applied by the same migrate command.

This is very usefull for production usage. When customer deploy an application, he as to migrate a first time, OK all migrations are applied. Next, I send an application update, the customer migrate simply migrate again and all new migration are applied. Now if the customer need to comeback to the previous version, he as to undo migration so, actually, he need to check name of last migration of the previous version. With my proposition, customer simply undo the last "group" (same time migration) and the app revert the the previous version because all migrations of the new version was applied by the same command.

To do it, I suggest to add a boolean column to the "sequelizemeta" table named "grouped". Migration row is set to false for first applied migration done by a migrate command and all next migrations applied by this same command is set to true because they are "grouped" with precedent. So at eatch execution of the migration command, a row and only one is set to false. The "undo:group" command has just to undo last migration and check if this unded migration was set to true. If yes, automatically undo the previous migration and so one while "grouped" field is true.

I can develop more or explain differently but I realy think that it can be a very good addition for production and most generaly to don't care of migration name while migrate or revert between program version.

Best Regards,

Lingua principale
JavaScript
Stelle
2.6k
Fork
524
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di sequelize/cli

Tutte le issue di sequelize/cli

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.