Commit Graph

7 Commits

Author SHA1 Message Date
silverqx 71d6e24e28 used NAME constant everywhere 2023-05-05 14:16:45 +02:00
silverqx a83dd8ce50 suppressed clang tidy warnings
Primarily in models and in one test case.
2023-01-06 21:22:18 +01:00
silverqx f6e33f1e67 enhanced and fixed Model instantiation
- primarily fixed instantiation with Default Attribute values with
   the QDateTime
 - revisited ctors and instance methods
 - added instanceHeap methods, create model instance on the heap
 - added instance method overloads with the connection override param.
 - added tests for all these new and old methods and ctor-s
 - used Model::instance() related methods all over the TinyORM to
   correctly support Model instantiation with Default Attribute values
   with the QDateTime
 - added a new Model constructor with the DontFillDefaultAttributes tag
   that instantiates a Model class without fill default attributes, to
   bypass CRTP problem with the QDateTime; this ctor is called from
   the instance()-related methods and the fill() method is called on
   already instantiated Model
   methods
 - updated NOTES.txt where the raw Model ctor-s were called
2022-11-05 18:45:31 +01:00
silverqx 8471ea6608 removed public specifier from seeders 2022-05-17 13:41:43 +02:00
silverqx cf8f3e651c renamed seeder classes to singular 2022-05-17 08:30:01 +02:00
silverqx 48947bf3d2 added docs for seeding 📃 2022-05-16 21:04:32 +02:00
silverqx d4557fc705 added database seeder 🔥🎉
The db:seed command invokes the root seeder DatabaseSeeder which can
invoke another seeders using the call() related methods. The root seeder
can be set by the --class command-line option and also by the --seeder
cmd. line option on some other commands like migrate:fresh/refresh.

Seeders can be passed to the Tom application in the similar way like the
migrations using the TomApplication::seeders<>() method or through the
constructor.

Arguments can be passed to the call<>() method, then the seeders run()
method will not be called using the virtual dispatch but using the type
traits. Of course the arguments passed to the call<>() method has to
match with the run() method parameters.

Others:

 - unified usingConnection() across all commands, this functionality was
   extracted to own class, previous it was a part of the Migrator class,
   so now every command even if it doesn't use Migrator can call
   the usingConnection() and it correctly sets a default connection and
   SQL queries debugging on the base of the -vvv command-line argument
 - a default database connection is now required, if not set then
   the exception will be thrown
 - added example seeders to the Tom application
2022-05-16 14:25:29 +02:00