Commit Graph

478 Commits

Author SHA1 Message Date
Pedro Henrique
3f4916ff8b dialect/sql/schema: fix issue with WriteDriver when using Postgres with Query (#3162) 2022-12-09 21:08:55 +02:00
Ariel Mashraki
122574376b dialect/sql: add except and intersect to builder (#3127)
* dialect/sql: add except and intersect for builder

* dialect/sql: report an error in case INTERSECT/EXCEPT ALL were set in SQLite

Co-authored-by: Liooo <ryoyamada3@gmail.com>
2022-11-28 14:54:59 +02:00
Pedro Henrique
397afc3d85 dialect/sql/schema: avoid setting the primary key when no primary key is present (#3114)
* dialect/sql: avoid setting the primary key when no primary key is present

* fix tests

* adds comment
2022-11-28 06:48:00 +02:00
Ariel Mashraki
f7109f0274 dialect/sql/schema: make WriteDriver friendlier (#3119)
Also, add a guide for writing and executing data migrations files.
2022-11-27 13:27:15 +02:00
cheny-alf
2840921231 dialect/sql: fix escape issue occurred in fuzzy testing (#3115)
* fix(builder):fix escape method

* fix(builder):fix escape method

Co-authored-by: chenfuqing <chenfuqing@laiye.com>
2022-11-26 13:26:14 +02:00
Ariel Mashraki
f46dd7ace8 dialect/sql/sqlgraph: add support for edge-schema in create-bulk 2022-11-20 17:37:08 +02:00
Ariel Mashraki
aa3d21f01a dialect/sql/sqlgraph: changing the M2M creation semantic from Add to Connect
Thus, calling AddE with the same edge values, ignore and not throw an error.
For edge-schemas with extra fields, we maintain the same logic because we cannot
determine if the extra fields have different values that what exist in the database
2022-11-20 17:37:08 +02:00
Ariel Mashraki
5954fa8b15 dialect/sql/schema: normalize ent/schema (desired state) on replay mode (#3100) 2022-11-16 20:01:36 +02:00
Ariel Mashraki
891fc8fecf dialect/sql/schema: support setting default value expressions on id fields (#3089) 2022-11-13 18:55:04 +02:00
Ariel Mashraki
1e5f68646f dialect/sql/entsql: support setting expression as column default value
Fixed https://github.com/ent/ent/issues/3069
2022-11-12 14:38:33 +02:00
Ariel Mashraki
3b5a535801 dialect/sql/schema: allow setting JSON default values on pg, sqlite and maria (#3081) 2022-11-11 07:41:21 +02:00
Ariel Mashraki
eae7d390a9 dialect/sql: add support for index operator-class using atlasgo.io (#3073) 2022-11-08 14:08:10 +02:00
Ronen Lubin
5d4f02620d dialect/sql/sqljson: add ValueIsNotNull predicate (#3058)
* dialect/sql: add json ValueIsNotNull predicate

* get rid of false positive dupl linter warning

* add json valueIsNotNull case to integration tests

* fix rejects
2022-11-02 11:18:15 +02:00
Ariel Mashraki
35d0d4c3db dialect/sql/sqlgraph: handle edge-schema in M2O/O2Oi calls entql 2022-11-01 19:46:33 +02:00
Ariel Mashraki
e7ce44adb1 dialect/sql: support mapping non-lowercased tags 2022-10-27 23:03:32 +03:00
Ariel Mashraki
fc9a4f9c6e dialect/sql: add example for OrderExpr on postgres 2022-10-26 21:08:39 +03:00
Ariel Mashraki
1bc4d48a51 dialect/sql: support scanning json fields (#3022) 2022-10-18 16:18:50 +03:00
Ariel Mashraki
8d40edf24b dialect/sql: add support for LIMIT in update statement (#3018) 2022-10-17 10:02:53 +03:00
Ariel Mashraki
bbdfea319d dialect/sql: support the RETURNING clause in UPDATE (#3016)
* dialect/sql: support the RETURNING clause in UPDATE
2022-10-16 17:55:01 +03:00
Andrey Elenskiy
fe4b19a355 dialect/sql: add Window function to be able to customize function clause for window statements (#2994) 2022-10-11 23:45:49 +03:00
Ariel Mashraki
cf137c665a dialect/sql/sqljson: cast marshaled args as json (#3008) 2022-10-11 14:15:01 +03:00
Ariel Mashraki
a8dde5e0d1 dialect/sql/sqlgraph: move fields setters to method calls (#2995) 2022-10-08 20:08:22 +03:00
Ronen Lubin
0eaa78f77d dialect/sql/sqljson: add option to evaluate json path inside a predicate (#2982)
* dialect/sql/sqljson: add option to evaluate json path inside a predicate

* add postgres test case
2022-10-02 15:56:15 +03:00
Ariel Mashraki
13bf27bdd6 entc/gen: support Append<F> for JSON array fields (#2975) 2022-09-29 16:57:54 +03:00
Ariel Mashraki
eb4ea68356 dialect/sql/sqljson: add dialect-aware Append function 2022-09-29 08:54:44 +03:00
Jannik Clausen
c41d223733 dialect/sql/schema: disable foreign keys before opening a transaction (#2966)
* dialect/sql/schema: disable foreign keys before opening a transaction

* dialect/sql/schema: disable foreign keys before opening a transaction

* fix tests

* add test for bug

* apply CR
2022-09-28 07:41:49 +02:00
Ariel Mashraki
e93e96ed1b dialect/sql/schema: use serial underlying types for fks (#2963) 2022-09-27 07:54:07 +03:00
Jannik Clausen
139725ee00 dialect/sql/schema: no longer allocate a PK range for a join table (#2950)
* dialect/sql/schema: no longer allocate a PK range for a join table

* test that no breaking change is introduced
2022-09-23 13:40:36 +03:00
Ariel Mashraki
3fc4ba6f15 dialect/entsql: add support for partial indexes (#2944) 2022-09-20 15:07:28 +03:00
Ariel Mashraki
0adfb94c30 dialect/sql: support defining multiple FROM in query (#2933) 2022-09-16 00:10:11 +03:00
Ariel Mashraki
cfb038810d dialect/sql/entsql: support including non-key columns in postgres indexes (#2912) 2022-09-07 22:09:48 +03:00
Giau. Tran Minh
2cdb627c0d dialect/sql/sqljson: quote non-identifiers (#2910)
* dialect/sql: fixed invalid json path quote

* fix: fixed empty string

* fix: fixed lint issue

* Apply suggestions from code review

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

* fix: added test to new case

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2022-09-07 14:49:11 +03:00
Ariel Mashraki
1773fc465e dialect/sql: add support for statement prefix in update builder (#2904) 2022-09-06 17:34:53 +03:00
Ariel Mashraki
2969796669 dialect/sql/sqlgraph: support batch-upadte for edge-schemas (#2897) 2022-09-02 15:33:41 +03:00
Abirdcfly
3b1b75b9d7 dialect/sql/sqljson: remove duplicate word in comments (#2892)
Signed-off-by: Abirdcfly <fp544037857@gmail.com>

Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-08-30 10:19:04 +03:00
Ryo Yamada
015effdcc1 dialect/sql/builder: added FullJoin (#2885)
* dialect/sql/builder: added FullJoin

* fix comment casing

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2022-08-30 07:39:35 +03:00
Ariel Mashraki
bedbea6665 dialct/sql/sqljson: fix HasKey implementation for SQLite (#2887) 2022-08-29 23:37:30 +03:00
Ariel Mashraki
79fe0ebcd6 sql/sqljson: add support for ValueIn/ValueNotIn (#2882) 2022-08-24 17:58:44 +03:00
Ariel Mashraki
2c63d1d70e all: gofmt -w -r 'interface{} -> any' (#2874) 2022-08-19 18:23:04 +03:00
Jannik Clausen
b6c185a660 dialect/sql/schema: make use of new atlas migration directories and r… (#2873)
* dialect/sql/schema: make use of new atlas migration directories and remove examples for custom formatters

* typo
2022-08-19 14:42:54 +02:00
Pedro Henrique
2b54aadcce dialect/sql: escape EqualFold on Postgres (#2860)
* adds tests for equalFold predicates

* ensure EqualFold escapes the argument on Postgres

* adds tests on builder as well
2022-08-16 10:09:06 +03:00
Ariel Mashraki
94b19ac973 dialect/sql: use raw NULL value in statements rather than passing nil arguments 2022-08-14 11:10:36 +03:00
Ariel Mashraki
0fd641333c dialect/sql/sqlgraph: support custom modifiers in UPDATE commands 2022-08-05 14:42:04 +03:00
Ariel Mashraki
9f481d8716 dialect/sql: support setting ORDER BY for UPDATE statements 2022-08-05 14:42:04 +03:00
Ariel Mashraki
26e07c90c0 dialect/sql/sqlgraph: support edgeschema in entgql (#2817) 2022-08-01 18:18:12 +03:00
Andy Day
8beaef87ba dialect/sql/builder: make sql.NotIn() with empty args fallback to NOT FALSE (#2757)
* dialect/sql/builder: make sql.NotIn() with empty args fallback to False()

This is basically the identical change to #2735, but for NotIn().

This bug currently prevents anyone using NotIn() from upgrading from v0.10.x to v0.11.x

* Update go.sum

untidy

* feedback
2022-07-19 06:36:39 +03:00
Ariel Mashraki
1c01301de1 sql/dialect/schema: support setting PK to serial types in postgres (#2748) 2022-07-13 14:40:56 +03:00
Ariel Mashraki
6c8a1308ec entc/gen: edge schema with custom ids (#2742)
Fixed https://github.com/ent/ent/issues/2740
Fixed https://github.com/ent/ent/issues/2741
2022-07-12 18:13:45 +03:00
Ryo Yamada
b00e549c88 dialect/sql: make sql.In() with empty args fallback to False() (#2735)
* dialect/sql/builder: make sql.In() with empty args fallback to False()

* fix indent

* added comment

* remove the equilvalent logic in the codegen side

* comment fix, run go generate
2022-07-12 00:15:36 +03:00
Jannik Clausen
bc623b3f64 all: update atlas (#2739) 2022-07-11 15:25:14 +02:00