Improve DatabaseCleaner Configuration API
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
La issue non indica file di implementazione o test; inizia esaminando l’attuale API di configurazione di DatabaseCleaner ::[] e i relativi casi d’uso documentati. La direzione proposta è ancora in attesa di feedback e non è stata prototipata, quindi per considerarla completata sarebbero necessari un design dell’API concordato e un comportamento validato per tutte le configurazioni semplici e complesse elencate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Way back in 2012, 016d66c4c9621fceadbebeb80feb5744d810c681 changed the ::[] API to act as both a command and query, in a decision based on pragmatism. At the time, @bmabey noted his dislike for this, and his desire to deprecate it. Now that we're talking about a v2.0 release, I think this is a good time to talk about improving this situation in a backwards-incompatible way.
I have an alternative API proposal that I've been exploring, which splits the ::[] method into ::[] for queries, and ::[]= for commands. Complex configuration is also simplified to a hash, or array of hashes:
# simple config
DatabaseCleaner[:active_record].strategy = :truncation
# complex config
DatabaseCleaner[:active_record] = {
connection: :test,
strategy: :truncation,
except: %w[goats donkeys],
}
# complex multiple db config
DatabaseCleaner[:active_record] = [
{ connection: :test, strategy: :truncation, except: %w[goats donkeys] },
{ connection: :test_2, strategy: :transaction },
]
I have been working on a document exploring what this API change would look like for DatabaseCleaner's many different use-cases, ranging from the most simplistic all the way up to very complex multiple ORM and database configuration, and this seems like this could work well, while also simplifying internals. I haven't prototyped it yet to confirm, but I even think its possible to add API this to the 1.x series in a backwards-compatible way, which would ease the v2.0 transition.
However, I want to get some feedback on this general direction before going too deep down the rabbit hole. Perhaps there is already an alternative API that you folks have in mind? Or perhaps we don't want to change the API at all at this point? But if this API looks promising, I'll post the document, and we can go from there!
- Lingua principale
- Ruby
- Stelle
- 3k
- Fork
- 484
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
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 DatabaseCleaner/database_cleaner
-
:transaction strategy: uncommitted data disappears after perform_enqueued_jobs on Rails ≥ 7.2Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 67/100
-
Cleaning of dev DBAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Cannot truncate a table referenced in a foreign key constraint (ActiveRecord::StatementInvalid)Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
DatabaseCleaner/database_cleaner#717 · 5 commenti · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
DatabaseCleaner/database_cleaner#716 · 2 commenti ·
Tutte le issue di DatabaseCleaner/database_cleaner
Issue simili
-
Add ZammadForse già presa @Arslan-TR l’ha presa oggi. Apertarequest
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
endoflife-date/endoflife.date#11298 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
performance v/6
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
WITCodingClub/calendar-backend#689 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
rubys/roundhouse#571 ·
I maintainer di solito rispondono entro 1 giorno
-
area/web interface
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
mastodon/mastodon#40924 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno