128 Commits

Author SHA1 Message Date
Billy Chan
08a5e87e22
Replace SeaORM's ColumnType (#1395)
* Replace SeaORM's `ColumnType`

* Bump SeaQuery's version

* Fix merge conflict

* refactor
2023-01-29 11:06:01 +08:00
Billy Chan
71dbffc725
Fix clippy (#1426)
* Fix clippy

* Fix clippy
2023-01-27 18:50:20 +08:00
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
Chris Tsang
4210526ec1
Merge pull request #1311 from SeaQL/select-into-tuple
Select into tuple
2023-01-10 15:20:14 +08:00
Chris Tsang
5c93253877 Tests 2023-01-09 14:46:19 +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
1135c117c3
fixup 2022-12-20 15:56:42 +08:00
Billy Chan
2f00a8757d
Merge branch 'master' into select-into-tuple 2022-12-20 15:51:06 +08:00
Billy Chan
d205338f3f
Try custom vector field (#1273) 2022-12-19 17:08:32 +08:00
Billy Chan
70c4a3a23e
Select into tuple 2022-12-15 21:24:10 +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
1be6673f0e
Fix DeriveActiveEnum expand enum variant starts with number (#1219) 2022-11-15 10:56:25 +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
29da37b4f2
Merge branch 'master' into sea-query-v0.27 2022-10-17 17:53:41 +08:00
Billy Chan
671d79469a
Fixup 2022-10-17 17:25:35 +08:00
wdcocq
880147c596
Blanket IntoActiveValue implementations so custom db types are supported (#833)
* Add blanket implementations of IntoActiveValue for optional values

* Add a compile test for DeriveIntoActiveModel
2022-10-11 23:47:17 +08:00
Billy Chan
77bddd85a5
Fixup 2022-09-22 15:07:37 +08:00
Billy Chan
43495de0aa
Fix clippy warnings - 1 (#967)
* Fix clippy warnings

* cargo fmt

* Fix clippy warnings

* cargo fmt
2022-08-12 20:02:53 +08:00
Billy Chan
d6831e5295
Bump version of sqlx, sea-query, sea-schema, time and uuid (#834)
* Bump version of sqlx, sea-query, sea-schema, time and uuid

* PostgreSQL `u32` was wrapped in `Oid` (launchbadge/sqlx#1602)

* Update test cases

* Fix clippy warnings

* cargo fmt

* Fix clippy warnings

* Bump sea-schema to ^0.9.2

* Update test cases

* Pin on sea-query minor version
2022-07-05 01:05:11 +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
5104cd3573
Insert & Update Return Model (#339)
* Update insert & update API

* Update test cases

* Update README

* Fix clippy warnings

* Fixup

* Fixup
2021-12-18 14:30:10 +08:00
Billy Chan
66a005237c
Update sea-orm to depends on sea-query 0.20.0 2021-12-12 23:03:11 +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
Billy Chan
0e4221bd72
Refactoring 2021-11-17 21:24:06 +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
3d5f4424a8
Fixup 2021-11-16 13:09:07 +08:00
Billy Chan
36886e74cd
Testing & fixup 2021-11-16 12:04:21 +08:00
Billy Chan
f504ad1eef
Refactor Schema 2021-11-11 15:11:52 +08:00
Billy Chan
bb78a1d709
More ergonomic DeriveActiveEnum derive macro 2021-11-03 15:38:42 +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