Commit Graph

498 Commits

Author SHA1 Message Date
Jannik Clausen
809b22be7c dialect/sql/schema: strip returning from seed (#3367) 2023-03-07 07:46:34 +01:00
Ariel Mashraki
7e2da46e09 dialect/sql/schema: expand fmt.Stringer args in WriteDriver (#3366) 2023-03-04 23:05:16 +02:00
Ariel Mashraki
3b7715b552 dialect/sql/schema: allow setting table comments (#3365) 2023-03-04 20:50:26 +02:00
Ariel Mashraki
f16451eab8 dialect/sql/schema: allow planning with indentation (#3363) 2023-03-04 10:06:53 +02:00
Ariel Mashraki
bd6f26aa7c dialect/sql/schema: allow configuring Atlas to return ErrNoPlan (#3322) 2023-02-16 21:56:51 +02:00
Ariel Mashraki
4e05f76717 dialect/sql: minor changes to allow using Migrate externally (#3316) 2023-02-14 15:06:36 +02:00
Ariel Mashraki
4c87e262a6 dialect/sql/schema: use the Atlas as state reader (#3314) 2023-02-14 10:20:34 +02:00
blukai
349b950978 dialect/sql/schema: ensure consistency of NotCleanError (#3310)
* dialect/sql/schema: ensure consistency of NotCleanError

For https://github.com/ariga/atlas/pull/1454

* get rid of cerr var

https://github.com/ariga/atlas/pull/1454#discussion_r1102391750
2023-02-10 13:25:53 +01:00
Ariel Mashraki
939c7cff1a entc/gen: reduce the usage of DISTINCT in queries (#3305)
Most queries are not graph traversals but rather regular table scans,
in which case the DISTINCT clause is not needed as duplicates cannot be
returned (unless query was modified by the user).
2023-02-06 22:40:50 +02:00
Ariel Mashraki
8022271f12 entc/integration: add example for composite unique index (#3302) 2023-02-06 11:17:33 +02:00
Ariel Mashraki
0e6ef32505 dialect/sql/sqlgraph: add update spec builder (#3301) 2023-02-06 07:13:06 +02:00
Ariel Mashraki
92cc7438f7 dialect/sql/sqlgraph: add deletion spec builder (#3291) 2023-02-01 11:55:00 +02:00
Ariel Mashraki
037b5a4bc3 dialect/sql/sqlgraph: add builders to create spec (#3288) 2023-01-31 09:37:51 +02:00
Ariel Mashraki
433609444c dialect/sql/sqljson: support for order by value and length (#3278) 2023-01-26 12:20:31 +02:00
Pedro Henrique
604c4942a4 dialect/sql: improve support for subqueries (#3274) 2023-01-26 09:43:07 +02:00
Ariel Mashraki
7ed84a86a8 dialect/sql/schema: skip destructive table changes (#3253)
This will be fixed also in Atlas, but having this extra safety here feels safer
2023-01-19 15:33:17 +02:00
Ariel Mashraki
fa1cf83fdd dialect/sql/sqlgraph: ignore ORDER BY clauses in COUNT queries (#3226) 2023-01-10 14:03:29 +02:00
Ariel Mashraki
b88f45aa78 entc/gen: skip executing sub-query for empty set of edges (#3212) 2023-01-07 08:54:18 +02:00
Ariel Mashraki
136807549d dialect/entsql: supports setting SQL column comments (#3191)
* feat: Add column comment in SQL DDL, using EntSQL annotations to achieve it.

* Update annotation.go

* fix lint

* Add table primary key column comment

* entsql.Comment(string)  is unnecessary

* entc/gen: minor changes to entsql.WithComments + add tests

Co-authored-by: chenghonour <wantto@outlook.com>
2022-12-26 14:48:37 +02:00
Ariel Mashraki
f226627d67 ent: export query interceptors (#3157) 2022-12-19 10:17:10 +02:00
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