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
Use utf8 on MinGW and ANSI with msvc.
The core of the problem is in the $$cat() and write_file() qmake
functions they don't know process UTF-8 encoded files, they use
the ANSI encoding.
Migration classes can be named in two formats, CamelCase without the
datetime prefix and snake_case with the datetime prefix.
If the CamelCase name is used then the T_MIGRATION macro has to be
also used in the migration class.
- also added a new validations of the migration class names
Created own tomconstants for the Tom namespace (folder tom/) and used
them everywhere.
Others:
- removed Q_GLOBAL_STATIC_WITH_ARGS() in migrationcreator.cpp and used
getter with the local static const
I had to reject designated initializers with commands because of gcc
throws -Wmissing-field-initializers warning with aggregates that have
a base class even empty base class, so I had to use classic aggregate
initialization with commands, it's not a big deal as all data members
of commands have to be initialized anyway as command aggregate classes
are tailor-made for a particular commands. I didn't want to suppress
this warning around every addCommand() method call.
- mainly default init. of data members
- some shadow/overlapping variable names in lambdas
- missing SHAREDLIB_EXPORT for SchemmaGrammar
Commands was extracted from the ColumnDefinition and has been created
own struct for every or very similar commands. They are now allocated
on the heap to save space because sizeof(ColumnDefinition) was 736 and
that is too much, eg if schema would contain 100 columns it would take
73KB.
I have decided not to use polymorphic commands, I wanted to use
designated initializers with aggregates, the consequence of this is
usage of reinterpret_cast() :/, but it works great.
- renamed commands from XxCommandDefinition to XxCommand
- get rid of a data member name collisions (eg index_, from_, ...)
in the column and command definitions, consequence of division
column and commands
Added practically everything I wanted to have in except for updating
columns.
Needed to name the schema namespace as Orm::SchemaNs to avoid collision
with the Orm::Schema class.
- unit tests with great coverage
- new schema constants
- a new prefix_indexes and engine DB conncetion configurations
Others:
- IsModel tag
- enhanced columnize in the BaseGrammar
- used a new columnize logic in all grammars
- new constants
- new container utils class for joining containers
- new DB::driver() getter for QSqlDriver
- avoid possible crash in tests with pretend, added empty log checks
- clang tidy, excluded to word from short variable names
Refactored from an unique_ptr to shared_ptr, I think this is a better
approach. Now it will be clear that a few DatabaseManager pointers are
stored somewhere in the TinyORM.
- return std:shared_ptr from DatabaseManager factory methods
- store a shared_ptr<DatabaseManager> in private data members in
DatabaseManager and DB classes
Queries counters extracted to the Concerns::CountsQueries base class.
- removed ConnectionInterface 😕😎🙌
- all methods are returning DatabaseConnection & instead of
ConnectionInterface
- includes cleanup after extraction
- explicit QStringLiteral and QChar
- fixed macro guard names
- inline from defn. to decl.
- whitespaces and comments
- added Q_DISABLE_COPY()
- removed friend class DB; from DM
- removed schemagrammar.cpp, was empty