Skip to content

migrate:rollback + migrate:latest + seed #191

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

Open
endel opened this issue Apr 16, 2025 · 2 comments
Open

migrate:rollback + migrate:latest + seed #191

endel opened this issue Apr 16, 2025 · 2 comments
Labels
enhancement New feature or request migrate Migrate module related seed Seed module related

Comments

@endel
Copy link

endel commented Apr 16, 2025

Hi there! I hope all is well!

I'm wondering if we could have an alias like Laravel has for re-running migrations from "fresh" state, and then re-running the seeds? Laravel has a migrate:fresh --seed command for this.

Please let me know if this is a welcome change so I can send a PR. If there's a different nomenclature that fits best kysely-ctl let me know! I think Laravel's nomenclature is clear enough and we could use the same.

Cheers!

@endel
Copy link
Author

endel commented Apr 16, 2025

I just noticed Laravel actually has fresh AND refresh 🤔
refresh does the rollback and fresh just drops all tables.
I could maybe send a PR implementing just refresh first.

@igalklebanov
Copy link
Member

igalklebanov commented Apr 17, 2025

Hey 👋

fresh seems like a VERY dangerous operation, as migrations are not always guaranteed to start from the first table's creation, or some tables are owned by other libraries - e.g. better-auth.

Is refresh basically rollback --all && latest?

  1. The naming is ambiguous. It's essentially a data wipe or rollback to seed (when --seed is there).
  2. There's already a way to achieve this without adding confusion of yet another command.
  3. This seems like something that doesn't scale well - gets slow very fast when you have lots of migration files to go over and recreates indexes. Could be achieved with a plugin+dummy driver that goes over all ups and collects all tables that were created but not dropped, truncates them, and maybe even resets sequences.
  4. The north star is Knex compatibility - this mixes Laravel with Knex concepts.

@igalklebanov igalklebanov added enhancement New feature or request migrate Migrate module related seed Seed module related labels Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request migrate Migrate module related seed Seed module related
Projects
None yet
Development

No branches or pull requests

2 participants