42 Commits

Author SHA1 Message Date
Billy Chan
e2b796b093
Cont. feat: expose database connection to ActiveModelBehaviour's methods (#1328)
* feat: expose database connection to `ActiveModelBehaviour`'s methods (#1145)

* Make ActiveModelTrait async

* Add tests

* refactoring

Co-authored-by: teenjuna <53595243+teenjuna@users.noreply.github.com>
2023-01-12 17:22:46 +08:00
Billy Chan
e9df3aa01d
Casting columns as a different data type on select, insert and update (#1304)
* Cast select and value

* Refactoring

* Test casting Postgres citext

* Fixup

* Revert

* Add test cases

* Fixup

* Rename methods
2023-01-12 14:56:11 +08:00
Billy Chan
4f5a15a99f
Support various UUID formats that are available in uuid::fmt module (#1325)
* Support various UUID formats that are available in `uuid::fmt` module

* clippy

* fixup
2023-01-11 14:13:15 +08:00
Billy Chan
e246d3faaf
Cont. Upgrade to SeaQuery 0.28.0 (#1366)
* Upgrade to SeaQuery 0.28.0

* Remove unnecessary heap allocation

* Upgrade sea-query-binder

* Upgrade sea-schema

* Fix

* Upgrade sea-schema

* refactoring

Co-authored-by: Ivan Krivosheev <py.krivosheev@gmail.com>
2023-01-05 20:41:28 +08:00
Billy Chan
d205338f3f
Try custom vector field (#1273) 2022-12-19 17:08:32 +08:00
Billy Chan
08cb44028e
Support bigdecimal::BigDecimal (#1258)
* Fix: fields with type `Option<T>` are always nullable

* Support BigDecimal
2022-12-01 12:53:19 +08:00
Billy Chan
4d8645ae8b
Support Vector of enum for Postgres (#1210)
* Support Vector of enum for Postgres

* Fix clippy

* Add tests for integer array

* Fix dependency

* Bump sea-query to 0.27.2

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-11-15 13:50:05 +08:00
Billy Chan
b5b9790252
Support array datatype in PostgreSQL (#1132)
* PostgreSQL array (draft)

* Fixup

* Fixup

* Fixup

* Fixup

* Fixup

* Refactoring

* generate entity for Postgres array fields

* Add tests

* Update Cargo.toml

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-10-23 18:26:57 +08:00
Billy Chan
77bddd85a5
Fixup 2022-09-22 15:07:37 +08:00
Billy Chan
ab2f784701
(de)serialize custom JSON types - 2 (#794)
* de(serialize) custom JSON types

* Rename DeriveTryGetableFromJson -> FromJsonQueryResult

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-07-01 01:27:46 +08:00
Billy Chan
fff738a706
cargo fmt 2022-06-21 11:12:28 +08:00
Billy Chan
5cf4d6022b
Vector of string save as serialized format in db (#783) 2022-06-12 22:23:30 +08:00
Billy Chan
cdc70f4fd9
Insert Default (#589)
* Insert default

* Update sea-query

* Fixup

Co-authored-by: Chris Tsang <chris.2y3@outlook.com>
2022-05-09 23:46:38 +08:00
Billy Chan
9687819a7e
Supports time crate 2022-03-13 18:18:15 +08:00
Chris Tsang
b8a7ae7351 Revert "Insert Default - Inserting ActiveModel with all attributes NotSet (#432)"
This reverts commit 33a87d79b1a789e8b47ed21bf22384289af7a487.
2022-02-06 21:52:08 +08:00
Chris Tsang
645a420eb1 cargo fmt 2022-02-06 14:47:45 +08:00
Chris Tsang
33a87d79b1 Insert Default - Inserting ActiveModel with all attributes NotSet (#432)
* feat: apply alias on `ColumnRef::SchemaTableColumn`

* build: update sea-query dependency

* feat: insert default

* Use sea-query 0.21

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2022-02-06 14:39:46 +08:00
Chris Tsang
e63d463155
Merge pull request #489 from SeaQL/date-time-utc-local
Support `DateTime<Utc>` & `DateTime<Local>`
2022-02-01 15:25:39 +08:00
Billy Chan
8145088814 Refactoring
`ColumnDef` with default value

Cargo fmt

Update docs

Fixup

Support `DateTimeLocal`

Update docs

Codegen write db timestamp column as `DateTimeUtc` type

Update dependency

Merge branch 'sea-query/add-new-column-ref' into pr/429

feat: apply alias on `ColumnRef::SchemaTableColumn`
2022-02-01 14:29:03 +08:00
Charles Chege
52f38a10ea Support the use of chrono::DateTime<Utc> in sea-orm
Add documentation for this

Temporarily use a fork to include new Sea-query code

Add tests for DateTimeUtc

Solve Github actions error by add the code to create a table

Assertion accuracy tests

Rectify incorrect format
2022-02-01 14:27:33 +08:00
Billy Chan
76c0d7fff5
Name conflict of foreign key constraints when two entities have more than one foreign keys (#417)
* fix: name conflict of foreign key constraints when two entities have more than one fk

* test: update test case's foreign keys

* feat: override default name of foreign key constraint
2022-01-28 01:03:24 +08:00
Billy Chan
96a776ae9d
test(Schema): add test cases for Schema::create_enum_from_entity & Schema::create_enum_from_active_enum 2021-12-22 16:14:17 +08:00
Billy Chan
0f164b62d5
Fix related & linked with enum columns (#376)
* Fix related & linked with enum columns

* Add test cases
2021-12-10 23:41:43 +08:00
Chris Tsang
aff988bd94
Merge pull request #324 from SeaQL/hotfix-custom-types
Unknown types could be a newtypes instead of `ActiveEnum`
2021-11-17 16:47:28 +08:00
Billy Chan
0f904e02f0
Refactoring 2021-11-17 10:38:02 +08:00
Billy Chan
36886e74cd
Testing & fixup 2021-11-16 12:04:21 +08:00
Billy Chan
2f7c9ccda7
Refactoring 2021-11-03 10:56:06 +08:00
Billy Chan
0bbb50b7f6
Merge remote-tracking branch 'origin/master' into active-enum 2021-11-03 10:52:29 +08:00
Billy Chan
d22ff0db5e
Fixup 2021-11-02 18:35:36 +08:00
Billy Chan
892c0fe57d
Support Vec<u8> primary key 2021-11-02 15:20:27 +08:00
Billy Chan
f88c7259fe
Fixup 2021-10-27 12:50:02 +08:00
Billy Chan
55de1968bb
Add create_enum_from_entity 2021-10-27 12:37:35 +08:00
Billy Chan
cf52839c3a
Typo 2021-10-25 17:12:17 +08:00
Billy Chan
4b1cac7f35
Refactoring 2021-10-25 17:05:27 +08:00
Billy Chan
f20c64988d
Tests all DB 2021-10-25 16:52:02 +08:00
Billy Chan
80c72004d1
Try Postgres enum 2021-10-21 15:43:50 +08:00
Billy Chan
d525c710ce
Merge remote-tracking branch 'origin/master' into active-enum 2021-10-20 18:43:39 +08:00
Billy Chan
868a469de0
Test integer enum 2021-10-20 18:02:23 +08:00
Billy Chan
32f82a0c9b Test self referencing relation 2021-10-20 16:38:10 +08:00
Billy Chan
18f37150d7
Fixup 2021-10-20 10:49:26 +08:00
Billy Chan
8627c8d961
Draft ActiveEnum 2021-10-19 19:08:02 +08:00
Chris Tsang
668fb64224 Refactor test suite 2021-10-15 15:46:25 +08:00