Commit Graph

41 Commits

Author SHA1 Message Date
silverqx
c4430453e6 drivers added SqlDatabase::record(tableName)
It allows to obtain a SqlRecord for the given table.

Populating the Default Column Values works the same way as
for the SqlQuery/SqlResult couterparts.

The recordCached() counterparts in SqlResult were not implemented
because of cache invalidation problems (not possible with the current
API, it's hard to implement).

This API always select-s all columns from the information_schema.columns
table, that's why the SqlResult::recordWithDefaultValues(allColumns)
has the allColumns parameter, it's used but this API/feature.

 - added functional tests
 - added a new empty_with_default_values table
 - logic that doesn't fit into the MySqlDriver class was extracted
   to the SelectsAllColumnsWithLimit0 concern 🕺
2024-07-20 19:58:54 +02:00
silverqx
31b8e06a9c fixtypo compiler names
Everywhere cmake, qmake, docs, ...
2024-06-25 12:13:10 +02:00
silverqx
8d5ca3803b orm added, revisited, fixed QTime
I completely revisited QTime, practically everything was touched as
prepared bindings, result sets, serialization, appends, casting.

 - added many new QTime related tests
 - added a new columns to migrations
 - updated seeder
 - added a new u_timeFormat data member for models
 - updated docs about u_timeFormat
2024-02-28 11:20:26 +01:00
silverqx
33a5fc79ab tests forgotten seeder update 2024-02-25 13:34:09 +01:00
silverqx
ae2f1477b0 tests added binary (blob) tests
- added a new tst_Blobs functional test case that inserts
   binary()/text() and mediumBinary()/mediumText()
 - updated schema builder unit tests, added all supported binary types
 - updated migrations
 - added Lorem ipsum paragraphs generator
2024-02-05 16:27:41 +01:00
silverqx
12a892fe6c testdata renamed sql file 2023-08-06 15:11:30 +02:00
silverqx
af12f2637f changed default environment to local 2023-07-24 16:25:47 +02:00
silverqx
c60dc1b0da tests added more seed data, to test relations
Added a new roles belongs-to-many relation to the Tag model to test
eager or lazy loading with select constraints.

 - updated affected unit tests
2023-06-17 17:27:56 +02:00
silverqx
1f5eedb38f models added new belongs-to-many relation
- for testing serialization
 - added two new migrations
 - added two new models
 - updated testdata_tom main.cpp
 - updated affected unit tests
2023-06-16 12:52:18 +02:00
silverqx
2c86b3eead sync php migrator 2023-06-15 21:22:36 +02:00
silverqx
7cb9288956 tests added more seed data, to test serialization
- updated affected unit tests
2023-06-15 21:22:18 +02:00
silverqx
b743faf050 tests added more seed data, to test serialization
- updated affected unit tests
2023-06-15 15:38:00 +02:00
silverqx
99a17f4d95 tests added more seed data, to test serialization
- updated affected unit tests
2023-06-14 16:33:00 +02:00
silverqx
8698b15e2e updated php migrations script (unfinished) 2023-05-06 14:42:35 +02:00
silverqx
5937044453 sync php seeder unfinished 2023-05-05 14:59:50 +02:00
silverqx
7f344a2145 added ModelsCollection 🔥🚀🎉
The Orm::Tiny::Types::ModelsCollection is container class with
additional handy methods like pluck(), whereIn(), filter(), ...
It extends the QVector. The template parameter can be the Model or
Model *, the model must be the Derived model type eg. Torrent, Post, ...

All ORM-related methods return the ModelsCollection so it can be easily
filtered, changed, transformed with one simple line or callback.
All the algorithms are nicely encapsulated in the ModelsCollection
methods.

Currently, there is this pattern, all TinyBuilder or Model methods are
returning the ModelsCollection<Derived> and all relation related
methods are returning the ModelsCollection<Derived *>.

 - added Album and AlbumImage migrations and seeder data (also PHP)
 - added Album and AlbumImage models
 - added functional tests for ModelsCollection<Model> and
   ModelsCollection<Model *>
 - all ModelsCollection methods or algorithms are unit tested
 - replaced all occurences of the QVector<Model> and QVector<Model *>
   with the ModelsCollection<Model> and ModelsCollection<Model *> 😵‍💫
 - tests added Model::findMany()
 - added reserve() on few places
 - removed useless #include-s
2023-05-05 13:06:15 +02:00
silverqx
226442d6f3 bugfix php seeder 2023-05-04 08:52:00 +02:00
silverqx
7525051a78 bugfix php seeder 2023-05-04 08:36:45 +02:00
silverqx
a80c003e4b renamed test databases prefix to tinyorm_
Renamed from q_tinyorm_.
2023-02-16 20:09:43 +01:00
silverqx
46808b1005 added unix timestamps support
The Model::u_dateFormat now also accepts 'U' for unix timestamps.
The database column type should be qint64 or int.

 - added extensive unit tests also for null values, for getAttribute()
   and also for setAttribute()
 - updated migrations, added a new added_on unix timestamp column
   to the Role model
 - updated database seeders
 - updated docs
2022-08-30 10:26:40 +02:00
silverqx
61bd9e87f1 added Soft Deleting support 🤯🙌
In addition to actually removing records from your database, TinyORM
can also "soft delete" models. When models are soft deleted, they are
not actually removed from your database. Instead, a deleted_at attribute
is set on the model indicating the date and time at which the model was
"deleted".

 - added docs
 - added all proxies
 - added complete functional tests and a few unit tests
 - carefully verified all possible scenarios because it changes
   practically all queries 🤯

Others:

 - also added from() to all proxies
 - bugfix in seeders, bad ID in the PostgreSQL primary key (sequence)
2022-08-26 18:21:45 +02:00
silverqx
f8f7d955a9 added table comment for file_property_properties
Comment is:

used in Builder::chunk() tests, must have exactly 8 rows
2022-07-26 18:03:46 +02:00
silverqx
8b9c9591d9 added is_banned boolean column to users table 2022-07-24 20:06:23 +02:00
silverqx
5cbea87321 added elapsed timer to php create/seed db script
[skip ci]
2022-06-23 11:02:18 +02:00
silverqx
9413daf99f workflows added tom SQLite migrations
- also removed php migrations from all workflows 🙌🥳
2022-06-21 08:35:55 +02:00
silverqx
2410a8b2cb code formatting 2022-06-20 17:40:34 +02:00
silverqx
2d3bfb0083 renamed dotenv example files
[skip ci]
2022-05-25 13:58:58 +02:00
silverqx
2cb8bb9b4b use tom migrations in unit tests for PostgreSQL 💪
- added fixPostgresSequences() to our tom seeder
 - added PostgreSQL connection to tom_testdata
 - updated msvc workflow
 - tom, throw if empty connection only if exactly one connection
   provided
 - also updated create_and_seed_database.php script to exclude postgres
   connection using --skip-postgres-migrate command-line parameter
2022-05-23 16:11:30 +02:00
silverqx
488037b33a used our seeder in workflows 🎉💪 2022-05-18 09:40:45 +02:00
silverqx
158f833293 updated error message 2022-05-18 09:01:23 +02:00
silverqx
28067cc10f whitespace 2022-05-17 17:15:05 +02:00
silverqx
5524407a23 whitespaces 2022-05-17 17:10:31 +02:00
silverqx
407c389cc8 added a new tom related env. variables to dotfiles 2022-05-12 13:38:11 +02:00
silverqx
285f654278 bugfix in skip-mysql-migrate condition 2022-05-12 13:01:11 +02:00
silverqx
3b05cd1bed used own tom migrations in unit tests 🎉 2022-05-12 12:25:22 +02:00
silverqx
b816c932dc removed unused code 2022-05-12 10:20:02 +02:00
silverqx
09592a7732 added GitHub Actions Linux, MSYS2 UCRT64, MSVC
- initial g++/clang build, ctest on MSYS2 UCRT64 on Windows Server 2022
 - initial cmake build/ctest on Ubuntu 20.40
 - initial cmake build/ctest on MSVC on Windows Server 2019

changed driver to QPSQL in tst_databasemanager

This avoids crash when QMYSQL driver's dll is unavailable.
QMYSQL driver is not shipped by default by Qt Windows MSVC installer.
2021-12-08 12:27:25 +01:00
silverqx
a71ba16800 fixed phpstorm warnings 2021-11-24 14:47:26 +01:00
silverqx
b19b88228f enhanced db seeder
When env. variables for some connection was not defined then do not
create/seed database for this connection.

 - connection to the database eagerly, before seeding starts
2021-11-24 14:39:28 +01:00
silverqx
335a64b9c8 added dotenv.sh example file 2021-09-15 20:06:01 +02:00
silverqx
0a433d3b4f moved testdata seeder to the tests/ folder 2021-09-04 16:36:19 +02:00