Commit Graph

22 Commits

Author SHA1 Message Date
silverqx
2e2b6e683a bugfix qt5 build missing #include 2022-04-29 10:30:17 +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
b732f6f115 QLatin1String to QStringLiteral 😎 2022-04-28 17:22:42 +02:00
silverqx
a3c137b953 added support for the linux g++/clang 2022-04-28 13:10:25 +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
ae65961d89 fixed clang-tidy/clazy warnings 2022-04-27 08:18:07 +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
f13ca22163 tried to make application methods const
Without success, I would have to create own parser for Command, I have
create FUTURE task for this.
2022-04-25 11:46:31 +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
13ab2db6df tom validate required positional arguments 2022-04-22 12:59:01 +02:00
silverqx
eb71a1f7de fix virtual dtors 2022-04-22 11:23:50 +02:00
silverqx
aabcf7852b removed token from heredoc literals 2022-04-22 09:54:11 +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
dec30fb972 added linux g++/clang support 2022-04-21 16:11:05 +02:00
silverqx
436c2f7f8a explicitly enable vt100 on MSYS2 ucrt64
The vt100 processing is not enabled on the MSYS2 ucrt64 by default so
enable it explicitly.

 - also moved terminal initialization code to the Tom::Terminal class
2022-04-21 13:46:57 +02:00
silverqx
39f8098932 added support for MSYS2 gcc/clang 2022-04-21 10:11:17 +02:00
silverqx
8c4990c111 tom finished make:migration command
Finished --path and --realpath options.

 - enhanced logic for checking whether a migration already exists
2022-04-20 17:11:58 +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
8db628b965 changed " to <> for #include 2022-04-13 19:35:07 +02:00
silverqx
b6f9b7899a add indent in #ifdef 2022-04-13 19:18:11 +02:00
silverqx
d03d8fc972 tom initial commit
- finished qmake build
2022-03-27 16:12:44 +02:00