Commit Graph

618 Commits

Author SHA1 Message Date
silverqx 5a184e136b added the connectionsSize() to DB/DM 2022-05-23 16:07:43 +02:00
silverqx 0bcbcd2431 added support for PostgreSQL schema builder 🎉👌
- added a new config. option dont_drop, allows to define table that
   will be excluded during dropAllTables(), has a default value
   spatial_ref_sys for PostGIS
 - implemented fluent commands, used only by the PostgreSQL Comment
   command
 - added tests for PostgreSQL schema builder
 - reworked tst_Migrate to be able to run on all supported connections,
   currently PostgreSQL and MySQL
 - updated docs

Unrelated:

 - added a new reference class IndexDefinitionReference for a nice API
   during index definition, contains algorithm and language
 - unified selectFromWriteConnection() in schema builders
2022-05-23 10:14:25 +02:00
silverqx 22bc8e2ccf deleted copy and move assign. operators
Deleted copy and move assign. operators for XyzReference classes, user
should not be able to assign a new reference on these classes.
2022-05-23 08:57:24 +02:00
silverqx 9d5ce17634 added hasConfig to DatabaseConnection 2022-05-23 08:54:30 +02:00
silverqx 04d3838d87 added comments 2022-05-22 18:59:27 +02:00
silverqx 54e3613a98 added a new TZ00 string constant
- used everywhere
 - updated docs
2022-05-18 09:57:06 +02:00
silverqx 0ad5d3e485 added new multi-insert overload to query builder
- also added all proxies
 - updated documentation
2022-05-18 09:23:09 +02:00
silverqx e1722bff1b bump versions TinyORM v0.4.0 and tom v0.2.0 2022-05-17 10:32:22 +02:00
silverqx 5932fc9111 fixed clang-tidy warning 2022-05-16 19:54:21 +02:00
silverqx d549db080e whitespace 2022-05-16 19:53:59 +02:00
silverqx b24aa41c46 fixed clang-tidy warning 2022-05-16 19:53:39 +02:00
silverqx 710cdb5358 used decltype() to obtain a type 2022-05-16 14:25:29 +02:00
silverqx 1b3b431873 extracted Model unguarded to own class
Extracting these guard related methods to own class allows to call
GuardedModel::unguarded() regardless of a template parameters needed
on the Model class, before was needed to call
Model<Torrent, Relations..>::unguarded().

 - also made the g_unguarded atomic
 - bugfix reguard() try-catch-finally in GuardedModel::unguarded()
2022-05-16 14:25:24 +02:00
silverqx ad818845d1 removed duplicate code 2022-05-16 10:28:38 +02:00
silverqx c238e3fd33 made some methods static 2022-05-16 10:27:46 +02:00
silverqx aa39fc7e76 fixed clang-tidy warning 2022-05-15 22:44:50 +02:00
silverqx ee6f802935 enhanced comment 2022-05-15 22:44:03 +02:00
silverqx 43c676a64d fixtypo 2022-05-12 10:19:02 +02:00
silverqx ea54b114c8 removed todo tasks 2022-05-10 18:11:56 +02:00
silverqx b09931b203 enhanced TinyOrm.pri and tom.pri
They can now also set up include directories and link against
the TinyORM library. It's accomplished by the TINYORM_BUILD_TREE
variable.

 - also updated all examples in the documentation
 - manually tried to recompile all the examples on all supported
   platforms
 - enhanced tiny_version_numbers.prf, throw error when the version file
   was not found or when the parsing failed
 - used qmake/common.pri in the TinyOrm.pri and tom.pri,
   the consequences are that the user can use eg "CONFIG += disable_orm"
   and all others supported qmake configurations on his own project, so
   if the TinyORM was compiled with some set of flags then the same set
   of flags has to be used on the compiled project, CMake is doing this
   automatically of course
 - added Configure using .qmake.conf to the hello world example
2022-05-06 16:14:33 +02:00
silverqx 94ec2a195d bump TinyORM version to v0.3.0 2022-05-05 21:02:00 +02:00
silverqx 19032fa338 added todo task 2022-05-05 14:17:39 +02:00
silverqx 5064af5f2b added/removed todo task 2022-05-05 11:52:45 +02:00
silverqx 13faf74494 docs, added tabulate dependency 2022-05-04 19:38:37 +02:00
silverqx 08c41ba9bd added new constant for utf80900 encoding 2022-05-04 10:56:28 +02:00
silverqx 48e6ee3d54 docs, added a new tom build options and macros 2022-05-03 14:39:18 +02:00
silverqx 987de03e4d added todo task 2022-05-03 07:52:23 +02:00
silverqx 9520716307 enhanced migration name logic for make:migration
Enhanced migration name detection for the make:migration, practically
all the possible combinations are allowed and handled correctly 👀😎.

Now is possible to pass the full migration name with the datetime prefix
and with the filename extension. All possible combinations are
supported.

Summarize, so an user can pass:

 - classname that will be converted to the studly case
 - filename without the datetime prefix (with or w/o extension)
 - filename with the datetime prefix (with or w/o extension)
2022-05-02 19:07:40 +02:00
silverqx c98833c7b6 updated comments 2022-05-02 12:11:48 +02:00
silverqx 98c61891c3 enhanced migration classes naming
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
2022-05-02 10:59:30 +02:00
silverqx 96d6d6b269 removed todo task 2022-04-29 20:33:59 +02:00
silverqx 0e3fb06d1b added ORM and TOM cmake options to github actions 2022-04-29 16:25:06 +02:00
silverqx da1470ffd5 finished printing options with values
- different render format for options with values --env[=ENV]
 - printing a default value part after the description
 - added some validations for option names, especially validate the size
 - fixed default value name in all commands, it should be upper
2022-04-29 08:32:47 +02:00
silverqx 9078fae60f fixed clang-tidy and clazy warnings 2022-04-28 17:04:42 +02:00
silverqx aa1815927d removed todo task 2022-04-28 14:35:58 +02:00
silverqx 133d9e525a removed todo task 2022-04-28 13:03:56 +02:00
silverqx 631280ad78 added string constants for tom
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
2022-04-28 13:03:46 +02:00
silverqx 373937958c provide custom migrations path to the tom example
User can provide a custom migrations path for the make:migration
command.

Default path is at database/migrations relative to the tom example
executable.

This allows to use the tom example as a real migration application and
the user doesn't have to create his own migration project.

Using:

 - TomApplication::migrationsPath()
 - TINYTOM_MIGRATIONS_PATH preprocessor macro, will be stringified
 - TOM_MIGRATIONS_PATH CMake PATH option
2022-04-26 19:56:48 +02:00
silverqx 44584be459 removed fixed todo tasks 2022-04-25 16:00:38 +02:00
silverqx 9933354594 moved tst_version auto test
Moved to the functional/others/ folder.
2022-04-25 15:22:36 +02:00
silverqx 7ba2e3cdae added guessing of namespace and command names 👌
Only partial names no matter of case can be passed, eg. mi:st for
the migrate:status, or m for the migrate command.
If the passed name is ambiguous then the error wall with all ambiguous
commands or namespaces is displayed, ambiguous commands also contain
a description.

Following positional arguments support guessing:

 - main command name at 0 position
 - command name passed to the help command
 - namespace name passed to the list command
2022-04-24 21:10:45 +02:00
silverqx e9ed083a18 fixed clang-tidy warning 2022-04-22 09:54:48 +02:00
silverqx 97e9059ea4 fixed all clang-tidy and clazy warnings 2022-04-21 22:17:49 +02:00
silverqx 91203b28ea missing includes without PCH on linux 2022-04-21 18:47:22 +02:00
silverqx 95ba86623d Merge branch 'migrations' into develop 2022-04-21 16:31:53 +02:00
silverqx a6213a6a9d added migrations 🔥🚀
Almost everything is implemented, possible to migrate up, down
(rollback), migrate by steps (works for up/down too), reset, refresh,
fresh, wipe database, showing status, installing migration table.

Command line interface is superb, it supports ansi coloring, verbosity,
no-interactive mode, force option, env option to select current env.

It has enhanced ansi coloring (vt100 terminal) detection, when ansi or
no-ansi option is not passed it can detect whether terminal supports
coloring.
Ansi coloring is disabled when redirection to file is detected (can
be overridden by ansi/no-ansi options).
Supports NO_COLOR env. variable (https://no-color.org/) and can detect
the ConEmu, Hyper, and xterm on Windows.

Carefully implemented help and list commands, list command can print
supported commands by namespace.

Advanced make migration command offers great command interface for
creating migration classes, supports options for generating empty,
create, or update migration classes.

Unfinished make project command, will support creating qmake, qmake
subproject, and cmake, cmake subproject projects. Later will be
extracted to own executable tomproject.exe for rapidly generating a new
TinyORM projects.

Other implemented commands are env that prints current env. and inspire
that displays an inspiring quote 😁.

Verbose supports 5 levels quiet, normal, verbose, very verbose, and
debug.

Possibility to disable compilation of the tom command related code using
TINYORM_DISABLE_TOM c macro, for the qmake exists disable_tom CONFIG
option and for the CMake exist TOM configuration option.

Confirmable interface that ask Y/N confirmation during migrate when
env. == production, can be overridden by --force option.

Whole tom terminal application supports or is implemented with UTF-8
support, also implemented UTF-16 output methods but they are not needed.
Input also supports UTF-8, currently only Y/N input is needed by the
Confirmation concern.

All migrate commands also support the --pretend option and the --env
option, when env. is production then tom asks confirmation to migrate,
it can be overridden by the --force option.

Added the tom example project, it is a complete command-line migration
application, it uses migrations from the tests.

Implementing this was really fun 🙃😎.

 - added 14 functional tests to test migrations up/down, stepping,
   installing migration table, refresh, reset on MySQL database
 - added unit test to check version number in tom.exe executable
 - new tom exception classes
 - created dozens of a new todo tasks 😂🤪, currently 348 todos 😎
 - added some info messages to the qmake build about building features
 - in the debug build and with the -vvv option enable debugging of sql
   queries
 - enhanced RC and manifest file generation, allowed to pass a custom
   basename for a RC/manifest file as the 3. argument and a custom
   replace token for the CMake genex as the 4. argument
 - bugfix disabled #pragma code_page(65001) // UTF-8 in RC files, it
   messes up the © character

Output of tom exe without arguments and options:

Common options:
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
      --env             The environment the command should run under
  -h, --help            Display help for the given command. When no
                        command is given display help for the list
                        command
  -n, --no-interaction  Do not ask any interactive question
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal
                        output, 2 for more verbose output and
                        3 for debug

Available commands:
  env                   Display the current framework environment
  help                  Display help for a command
  inspire               Display an inspiring quote
  list                  List commands
  migrate               Run the database migrations
 db
  db:wipe               Drop all tables, views, and types
 make
  make:migration        Create a new migration file
  make:project          Create a new Tom application project
 migrate
  migrate:fresh         Drop all tables and re-run all migrations
  migrate:install       Create the migration repository
  migrate:refresh       Rollback and re-run all migrations
  migrate:reset         Rollback all database migrations
  migrate:rollback      Rollback the last database migration
  migrate:status        Show the status of each migration
2022-04-20 15:45:35 +02:00
silverqx 342c167e5a bugfix shared_ptr for command definitions
Commands in the blueprint don't have virtual dtors, they are not
polymorphic, so shared_ptr has to be used because it can correctly
destroy these aggregates.
2022-04-14 16:33:27 +02:00
silverqx 0290212d36 removed todo task 2022-04-13 19:54:29 +02:00
silverqx b9343e45d4 bugfix shared_ptr for command definitions
Commands in the blueprint don't have virtual dtors, they are not
polymorphic, so shared_ptr has to be used because it can correctly
destroy these aggregates.
2022-04-13 19:42:37 +02:00
silverqx 5cd54ebbef converted tiny utils to library classes
- added Type::isTrue()
 - added studly() and splitStringByWidth() to StringUtils
 - used using XxUtils for all Tiny library classes everywhere
2022-04-13 19:32:42 +02:00