mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-01-05 18:40:02 -06:00
renamed TINY/TOM_MIGRATIONS_DIR
Renamed cmake option and macro from the TINY/TOM_MIGRATIONS_PATH to the TINY/TOM_MIGRATIONS_DIR. - updated documentation - extracted init. code for the TINYTOM_MIGRATIONS_DIR to the own cmake macro
This commit is contained in:
@@ -167,25 +167,15 @@ target_optional_compile_definitions(${TinyOrm_target}
|
||||
line interface)."
|
||||
DISABLED TINYORM_DISABLE_TOM
|
||||
)
|
||||
|
||||
# Depends on the TOM option so defined here
|
||||
feature_option_dependent(TOM_EXAMPLE
|
||||
"Build the tom command-line application example" OFF
|
||||
"TOM" TOM_EXAMPLE-NOTFOUND
|
||||
)
|
||||
|
||||
# Depends on the TOM_EXAMPLE option so defined here
|
||||
if(TOM_EXAMPLE)
|
||||
# Provide the default migrations path for the make:migration command
|
||||
if(NOT DEFINED TOM_MIGRATIONS_PATH)
|
||||
file(REAL_PATH "${TomExample_folder}/${TomMigrations_folder}" TOM_MIGRATIONS_PATH
|
||||
BASE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
# Set path from the -D option or from the above file(REAL_PATH) command
|
||||
set(TOM_MIGRATIONS_PATH "${TOM_MIGRATIONS_PATH}" CACHE PATH
|
||||
"Default migrations path for the make:migration command")
|
||||
|
||||
mark_as_advanced(TOM_MIGRATIONS_PATH)
|
||||
endif()
|
||||
tiny_init_tom_migrations_dir()
|
||||
|
||||
# TinyORM library header and source files
|
||||
# ---
|
||||
@@ -313,7 +303,7 @@ if(TOM_EXAMPLE)
|
||||
target_compile_definitions(${TinyOrm_target}
|
||||
PUBLIC
|
||||
# Will be stringified in the tom/application.cpp
|
||||
TINYTOM_MIGRATIONS_PATH=${TOM_MIGRATIONS_PATH}
|
||||
TINYTOM_MIGRATIONS_DIR=${TOM_MIGRATIONS_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -247,3 +247,25 @@ constants")
|
||||
unset(tinyExternConstants)
|
||||
|
||||
endmacro()
|
||||
|
||||
# Initialize the default migrations path for the make:migration command
|
||||
macro(tiny_init_tom_migrations_dir)
|
||||
|
||||
if(TOM_EXAMPLE)
|
||||
# Provide the default migrations path for the make:migration command
|
||||
if(NOT DEFINED TOM_MIGRATIONS_DIR)
|
||||
# Relative path to the pwd
|
||||
set(TOM_MIGRATIONS_DIR ${TomMigrations_folder})
|
||||
# Absolute path
|
||||
# file(REAL_PATH "${TomExample_folder}/${TomMigrations_folder}"
|
||||
# TOM_MIGRATIONS_DIR BASE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
# Set path from the -D option or from the above file(REAL_PATH) command
|
||||
set(TOM_MIGRATIONS_DIR "${TOM_MIGRATIONS_DIR}" CACHE PATH
|
||||
"Default migrations path for the make:migration command")
|
||||
|
||||
mark_as_advanced(TOM_MIGRATIONS_DIR)
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
# Default migrations path as the string for the make:migration command
|
||||
# The path can be absolute or relative (to the pwd at runtime)
|
||||
# It will look like this on the cmd. line: -DTINYTOM_MIGRATIONS_PATH="<path>/<path>"
|
||||
# It will look like this on the cmd. line: -DTINYTOM_MIGRATIONS_DIR="<path>/<path>"
|
||||
# If the path doesn't contain a space then the \" is not needed
|
||||
# Will be stringified in the tom/application.cpp
|
||||
#DEFINES += TINYTOM_MIGRATIONS_PATH="\"database/migrations\""
|
||||
#DEFINES += TINYTOM_MIGRATIONS_DIR="\"database/migrations\""
|
||||
|
||||
# Dependencies include and library paths
|
||||
# ---
|
||||
|
||||
@@ -271,7 +271,7 @@ But a special situation is when you are building your application / library and
|
||||
| `TINYORM_INLINE_CONSTANTS` | Defined when global inline constants are used.<br/><small>Defined when [`inline_constants`](#inline_constants) <small>(qmake)</small> / [`INLINE_CONSTANTS`](#INLINE_CONSTANTS) <small>(cmake)</small> configuration `build option` is enabled.</small> |
|
||||
| `TINYORM_TESTS_CODE` | Enable code needed by unit tests, eg. connection overriding in the `Orm::Tiny::Model`.<br/><small>Defined when [`build_tests`](#build_tests) <small>(qmake)</small> / [`BUILD_TESTS`](#BUILD_TESTS) <small>(cmake)</small> configuration `build option` is enabled.</small> |
|
||||
| `TINYORM_DISABLE_THREAD_LOCAL` | Remove all [`thread_local`](https://en.cppreference.com/w/c/language/storage_duration) storage duration specifiers, it disables threading support.<br/><small>Defined when [`disable_thread_local`](#disable_thread_local) <small>(qmake)</small> / [`DISABLE_THREAD_LOCAL`](#DISABLE_THREAD_LOCAL) <small>(cmake)</small> configuration `build option` is enabled.</small> |
|
||||
| `TINYTOM_MIGRATIONS_PATH` | Default migrations path for the `make:migration` command, can be an absolute or relative path (to the <abbr title='Current working directory'>pwd</abbr>).<br/><small>Default value: `<build_dir>/examples/tom/database/migrations`</small><br/><small>Defined by [`TOM_MIGRATIONS_PATH`](#TOM_MIGRATIONS_PATH) <small>(cmake)</small> configuration build option.<br/><small>(qmake note) You can use `DEFINES += TINYTOM_MIGRATIONS_PATH="\"database/migrations\""` on the command-line or set it in the __main__ [`conf.pri`](https://github.com/silverqx/TinyORM/blob/main/conf.pri.example#L4-L9) file.</small></small> |
|
||||
| `TINYTOM_MIGRATIONS_DIR` | Default migrations path for the `make:migration` command, can be an absolute or relative path (to the <abbr title='Current working directory'>pwd</abbr>).<br/><small>Default value: `<build_dir>/examples/tom/database/migrations`</small><br/><small>Defined by [`TOM_MIGRATIONS_DIR`](#TOM_MIGRATIONS_DIR) <small>(cmake)</small> configuration build option.<br/><small>(qmake note) You can use `DEFINES += TINYTOM_MIGRATIONS_DIR="\"database/migrations\""` on the command-line or set it in the __main__ [`conf.pri`](https://github.com/silverqx/TinyORM/blob/main/conf.pri.example#L4-L9) file.</small></small> |
|
||||
|
||||
</APITable>
|
||||
</div>
|
||||
@@ -382,7 +382,7 @@ CMake multi-config generators like `Ninja Multi-Config` or `Visual Studio 16 201
|
||||
| `ORM` | `ON` | Controls the compilation of all `ORM-related` source code, when this option is `disabled`, then only the `query builder` without `ORM` is compiled. Also excludes `ORM-related` unit tests. |
|
||||
| `TOM` | `ON` | Controls the compilation of all `Tom-related` source code, when this option is `disabled`, then it also excludes `Tom-related` unit tests. |
|
||||
| `TOM_EXAMPLE` | `OFF` | Build the <abbr title='TinyORM Migrations'>`Tom`</abbr> command-line application example (console application). |
|
||||
| `TOM_MIGRATIONS_PATH` | `-` | Default migrations path for the `make:migration` command, can be an absolute or relative path (to the <abbr title='Current working directory'>pwd</abbr>).<br/><small>Default value: `${CMAKE_BINARY_DIR}/examples/tom/database/migrations`</small> |
|
||||
| `TOM_MIGRATIONS_DIR` | `-` | Default migrations path for the `make:migration` command, can be an absolute or relative path (to the <abbr title='Current working directory'>pwd</abbr>).<br/><small>Default value: `${CMAKE_BINARY_DIR}/examples/tom/database/migrations`</small> |
|
||||
| `VERBOSE_CONFIGURE` | `OFF` | Show information about `PACKAGES_FOUND` / `PACKAGES_NOT_FOUND` in the CMake configure output. |
|
||||
|
||||
</APITable>
|
||||
|
||||
@@ -16,9 +16,9 @@ TINY_SYSTEM_HEADER
|
||||
|
||||
/* Default migrations path for the make:migration command, the path can be absolute or
|
||||
relative (to the pwd at runtime) and will be stringified in the tom/application.cpp. */
|
||||
#ifndef TINYTOM_MIGRATIONS_PATH
|
||||
#ifndef TINYTOM_MIGRATIONS_DIR
|
||||
// NOLINTNEXTLINE(bugprone-macro-parentheses)
|
||||
# define TINYTOM_MIGRATIONS_PATH database/migrations
|
||||
# define TINYTOM_MIGRATIONS_DIR database/migrations
|
||||
#endif
|
||||
|
||||
#endif // TOM_CONFIG_HPP
|
||||
|
||||
@@ -112,7 +112,7 @@ Application::Application(int &argc, char **argv, std::shared_ptr<DatabaseManager
|
||||
, m_environmentEnvName(environmentEnvName)
|
||||
, m_migrationTable(std::move(migrationTable))
|
||||
, m_migrationsPath(initializeMigrationsPath(
|
||||
TINYORM_STRINGIFY(TINYTOM_MIGRATIONS_PATH)))
|
||||
TINYORM_STRINGIFY(TINYTOM_MIGRATIONS_DIR)))
|
||||
, m_migrations(std::move(migrations))
|
||||
{
|
||||
// Enable UTF-8 encoding and vt100 support
|
||||
|
||||
Reference in New Issue
Block a user