Allow packages to hook into migrate:fresh before tables are dropped
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start with src/db/commands.rs, where the issue says the built-in migrate:fresh command and its private options are defined, then check docs/console.md for command registration behavior. The issue proposes a pre-drop hook or an extendable command; done means packages can clean up before tables are dropped while the built-in fresh migration behavior remains available. An open linked pull request indicates work is already underway.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Following up on this thread on X with the details in an issue.
Building tenancy-laravel-rust, a multi-tenancy package inspired by stancl/tenancy. Each tenant has its own database (or PostgreSQL schema), tracked in a tenants table in the central database. Very much the rust stancl v4 tenancy conversion (I need it faster than probably it'd arrive)
The problem
migrate:fresh drops every table in the central database, including tenants. That leaves those tenant databases and schemas orphaned, with nothing left that records they exist.
Previously this was handled with an opt-in drop_tenant_databases_on_migrate_fresh setting that hooks into Laravel's migrate:fresh. Right now my workaround is a separate tenants:drop command (in the commands docs) that users have to remember to run before migrate:fresh... and I kinda hate that anything "needs to be remembered"
Why a package can't do this today
As of v0.1.6, registering a command with the same name replaces the previous definition (docs/console.md). The built-in command is a private Fresh struct with private MigrateOptions in src/db/commands.rs, so a package that replaces migrate:fresh can't call the original afterwards.
To do it that way, the package would have to reimplement migrate:fresh (dropping everything, schema dump loading, seeding, --database, --force prompts, missing-database creation), which I'd rather not duplicate. An app's own migrate:fresh command would also override the package's anyway.
What would solve this
I'm happy with whatever shape fits the framework, but either of these would work:
- An event or hook that fires before
migrate:freshdrops tables, with the connection name (ideally only for the default/central connection), so a package can register a listener. - Making the built-in
migrate:freshcommand callable or extendable so a package can wrap it: run its cleanup, then hand off to the original.
A before hook is the minimum; I don't need an after hook, never going to complain about more hooks though.
- Lingua principale
- Rust
- Stelle
- 847
- Fork
- 174
- Merge medio
- 5h 40m
- PR unite (30g)
- 167
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di laravel/rust-framework
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
laravel/rust-framework#864 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
laravel/rust-framework#876 ·
I maintainer di solito rispondono entro 1 giorno
-
Case-sensitive contains, starts_with and ends_with that match % and _ literally on every databaseAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
laravel/rust-framework#874 ·
I maintainer di solito rispondono entro 1 giorno
-
Unicode case-insensitive like and contains on SQLite (or a hook to register SQLite functions)Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
laravel/rust-framework#873 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
laravel/rust-framework#872 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di laravel/rust-framework
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
neuralmagic/crucible#579 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
eclipse-score/kyron#249 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
seanmonstar/reqwest#3157 ·
I maintainer di solito rispondono entro 2 giorni