992 Commits

Author SHA1 Message Date
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
5c2013b5fd entc/integration: example for #2846 2022-08-14 11:10:36 +03:00
Ariel Mashraki
8fc8d65a16 doc/fields: add section for nillable-required fields 2022-08-13 20:12:28 +03:00
Ariel Mashraki
b207429f15 entc/gen: allow setting required fields as nillable 2022-08-13 20:12:28 +03:00
Ariel Mashraki
c8fc927f0d entc/gen: add tests for bulk-upsert fix in #2840 (#2845) 2022-08-12 21:12:34 +03:00
Viktoriia Dlugopolskaia
7eb1ccd274 entc/gen: ignore immutable fields updating during bulk upsert (#2840) 2022-08-12 19:50:05 +03:00
Ariel Mashraki
0066eb986d entc/gen: extend sql/modify to UPDATE statements 2022-08-05 14:42:04 +03:00
Ariel Mashraki
47972774c5 go: bump go/packages version ci to 1.18+1.19 (#2832)
* bumped pkg golang.org/x/tools version to address issue #2826

* .github: update go1.19 in go generate

Co-authored-by: Ankit Patial <ankitpatial@gmail.com>
2022-08-05 11:17:53 +03:00
Giau. Tran Minh
89007ec983 entc/gen: fixed privacy filter for M2M edges (#2828)
* entc: fixed privacy filter for M2M

* all: codegen
2022-08-03 23:24:25 +03:00
Ariel Mashraki
26e07c90c0 dialect/sql/sqlgraph: support edgeschema in entgql (#2817) 2022-08-01 18:18:12 +03:00
Ariel Mashraki
9673a4d506 entc/gen: allow naming ent/schema as Field (#2811) 2022-07-29 13:17:20 +03:00
Ariel Mashraki
f5568d2825 entc/gen: skip generating predicates that conflicts with FieldID constant (#2810) 2022-07-29 10:03:30 +03:00
Ariel Mashraki
6f356228e1 entc/integration: exmaple for multischema in migration (#2804) 2022-07-27 17:04:59 +03:00
Ariel Mashraki
b60e0f9eac entc/gen: add support for WithNamed<E> feature-flag (#2792)
* entc/gen: struct fields and methods for NamedEdge api

* entc/gen: generate WithNamedEdge methods for named-edges

* entc/gen: implement eager-loading for named-edges

* entc/gen: simplify eager-loading template

* entc/gen: drop support for unqiue edges in named-based loading

* all: codegen

* doc/website: named-edges feature-flag

* Update doc/md/eager-load.mdx

* Update doc/md/eager-load.mdx
2022-07-24 18:41:07 +03:00
Ariel Mashraki
a2b18f24f0 entc/gen: move eager-loading to method (#2790)
This is a preparation work for 'WithNamed<E>' API
2022-07-23 23:46:02 +03:00
Sasha Melentyev
5daf02bc73 go: small refactoring for maps (#2619) 2022-07-19 18:07:55 +03:00
Ariel Mashraki
077670451a entc/gen: skip enum identifier checks in case it has custom Go type (#2766)
Fixes https://github.com/ent/ent/issues/2756
2022-07-17 17:14:43 +03:00
Sasha Melentyev
9e0d8af284 ent/gen: use error.New for errors without format (#2764) 2022-07-17 16:50:50 +03:00
Ariel Mashraki
ddc46d34d8 schema/field: correctly extract package names from type identifier (#2765)
Fixes https://github.com/ent/ent/issues/2761
2022-07-17 16:49:11 +03:00
Ariel Mashraki
01f97334af entc/gen: use custom schema-type in join tables foreign-keys (#2760)
Fixed https://github.com/ent/ent/issues/2753
2022-07-15 11:01:13 +03:00
Ariel Mashraki
047b804dcd ent/gen: remove unnecessary if block in IN predicates (#2758) 2022-07-15 10:30:23 +03:00
Amr Tamimi
4491610202 entc/gen/integration: add example for edge schema with privacy (#2743) 2022-07-13 19:25:09 +03:00
Ariel Mashraki
b5b5d87f08 entc/gen/integration: re-enable postgres tests (#2749) 2022-07-13 18:30:57 +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
3148324cbe entc/gen: support edgeschema with privacy (#2745) 2022-07-13 11:54:40 +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
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
Reiji Tokuda
91b643091f entc/gen: support setting GoType for integer IDs (#2657)
* Fix problem when model maps integer id to a GoType

* Update generated files

* apply suggestions from code review

* Update generated files

* Update generated files after merge from master

* Cleanup test code in integration

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

* Modify integration test IntSID.

Wrapped tests of IntSID for avoid conflicts.

* Modify tests in integrations

Order of tests was changed. As a result, if-statement for difference in RDB is deleted.

+ force pushing same commit to invoke ci.

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2022-07-04 08:50:51 +03:00
Ariel Mashraki
ed783dba70 dialect/sql/sqlgraph: support edge-schema in upsert (#2714) 2022-07-03 23:29:35 +03:00
Giau. Tran Minh
4f7b1739cd entc: cleanup defaults ID (#2709) 2022-07-01 23:30:18 +03:00
Ariel Mashraki
904b649120 entc/gen: skip nodes with composite id types on default id-type detection (#2708)
Was reported on Discord
2022-07-01 23:08:45 +03:00
Ariel Mashraki
4a26cab734 improve multi-tenancy example and documentation (#2705)
* example/privacytenant: support edge-field and improve code examples

* md/privacy: improve multi-tenancy documentation
2022-06-30 19:57:56 +03:00
Ariel Mashraki
6793d74da7 schema/field: support for sensitive json fields (#2701)
Closed https://github.com/ent/ent/issues/2596
2022-06-29 11:27:10 +03:00
Ariel Mashraki
7cac3b2ed5 entc/gen: support default id values for edge schemas (#2688) 2022-06-25 20:23:43 +03:00
Ariel Mashraki
6ddeb93649 entc/gen: use gotypw pkgname as alias in case it does not match pkgpath (#2686) 2022-06-25 11:05:15 +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
Giau. Tran Minh
195be2d98d entc/gen: fixed unnamed field initialization (#2648)
* entc/gen: fixed ConstraintError fields name

* fix: run go generate

* entc/gen: fixed Filter fields name

* fix: run go generate again for entql
2022-06-14 12:32:46 +03:00
Will Bicks
cd1afb235c entc: improve generated comments for edges and fields (#2632)
* replace default field comment with user comment if defined
* use comments defined on edges in generated entities
* add docs for comment method on edges and fields
* update integration to reflect above changes
2022-06-13 15:52:47 +03: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
hax10
e6152856b1 entc/gen: fix name clash in entc template when entity name has initials as tx (#2633) 2022-06-09 20:39:46 +03:00
Ariel Mashraki
fd955654a0 entc/gen: change codegen signature from entc to ent (#2627) 2022-06-07 17:48:17 +03:00