Commit Graph

464 Commits

Author SHA1 Message Date
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
Ariel Mashraki
ba582c83b3 entc/gen: improve edge-schema updates (#2726)
Also, added additional example where an edge schema has another edge
to a type that holds an information about the relationship.

The only reason this example exists is to allow users to reduce the storage
occupied by the join-table and allow connect (via M2O) multiple edge-schemas
to an 'information'/'description' node.
2022-07-07 07:34:17 +03:00
Jannik Clausen
412f5f75ca add docs about auto-increment counter "bug" in MySQL versions < 8.0 and how to handle it (#2722) 2022-07-06 10:34:39 +02:00
Ariel Mashraki
2c1a3555cc entc/gen: ignore edge-fields order in edge-schema with composite identifiers (#2719)
This PR allows defining edge schemas with any order of their edges
but still enforce the ordering of the fields in the ID annotation
2022-07-05 15:45:28 +03:00
Ariel Mashraki
8c55008a9d dialect/sql/sqlgraph: handle edge schema in batch inserts (#2718) 2022-07-05 14:15:31 +03:00
Jannik Clausen
5b67bdab4f dialect/sql/schema: atlas engine is now default (#2698)
* atlas engine is default, enabled diff by replay

* Apply suggestions from code review

* docs

* apply CR
2022-07-05 12:29:15 +02:00
Ariel Mashraki
ed783dba70 dialect/sql/sqlgraph: support edge-schema in upsert (#2714) 2022-07-03 23:29:35 +03:00
Ariel Mashraki
8416fb502d dialect/sql/schema: setup tables before running migrate diff (#2703)
Keep the same API as schema.Create
2022-06-30 09:55:40 +03:00
Hafiz Shafruddin
5dbfa24b46 doc/md: add docs on using expression predicates in custom WHERE clauses (#2520)
* Add docs on using ExprP() for custom WHERE sql statement

* Add ExprP() examples using integration test

* move custom predicate example and show examples using both P() and ExprP()

* fix to greater or equal than

* rephrase wording and fix sql builder

* Update doc/md/predicates.md

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

* Update doc/md/predicates.md

* Update doc/md/predicates.md

* Update doc/md/predicates.md

* Update doc/md/predicates.md

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2022-06-29 11:24:20 +03:00
Ariel Mashraki
311d760679 entc/gen: allow opening and testing concurrent enttest clients (#2665) 2022-06-20 08:32:30 +03:00
Ariel Mashraki
abefaa7f24 entc/gen: catch constraint failures in delete operations (#2664) 2022-06-19 14:34:32 +03:00
Ariel Mashraki
98d00a35b5 go: update atlas and test global-unique-id migration (#2661) 2022-06-18 21:50:44 +03:00
Jannik Clausen
7017cbc898 dialect/sql/schema: file based type store (#2644)
* dialect/sql/schema: file based type store

This PR adds support for a file based type storage when using versioned migrations. The file called `.ent_types` is written to the migration directory alongside the migration files and will be kept in sync for every migration file generation run.

In order to not break existing code, where the type storage might differ for different deployment, global unique ID mut be enabled by using a new option. This will also be raised as an error to the user when attempting to use versioned migrations and global unique ID.

Documentation will be added to this PR once feedback on the code is gathered.

* apply CR

* fix tests

* change format of types file to exclude it from atlas.sum file

* docs and drift test

* apply CR
2022-06-15 16:10:15 +02:00
Jannik Clausen
bfa9c963cb dialect/sql/schema: introduce type store interface (#2636)
This will allow us to store information about pk ranges allocated per type in a different location thant the database. This is useful for deterministic pk range computation for things like generating atlas.hcl out of the Ent schema.
2022-06-10 10:08:33 +02:00
Ariel Mashraki
5b81d7d832 dialect/sql/sqlgraph: better support for update nodes with predicates (#2574) 2022-05-29 16:23:52 +03:00