drogonframework/drogon

dg_ctl create model -- support namespaces

Open

#1.591 geöffnet am 7. Mai 2023

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)C++ (1.014 Forks)batch import
enhancementgood first issue

Repository-Metriken

Stars
 (10.462 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 2T 2h) (7 gemergte PRs in 30 T)

Beschreibung

Is your feature request related to a problem? Please describe. When (re)creating the models using the dg_ctl create model ... command, the model-classes are automatically created in a namespace equal to the configured database name. I would like to use a simpler namespace name than how I've named my database. Defining a custom namespace also can advoid accedental model-namespace changes when working together with someone who has it's database named differently.

Describe the solution you'd like An option in the dg_ctl create model ... command and/or a key in the model.json file where a custom namespace name can be defined. Here follow some input-result examples:

  • dg_ctl create model . -> drogon_model::dbname::ModelName (default behaviour)
  • dg_ctl create model . --namespace "" -> drogon_model::ModelName (optional)
  • dg_ctl create model . --namespace "HelloDg" -> drogon_model::HelloDg::ModelName

I think this should be a small change but a helpfull one.

Contributor Guide