Commit Graph

556 Commits

Author SHA1 Message Date
Ariel Mashraki
f3f03e1edd schema/edge: add support for configuring foreign-key symbols
Fixed #1423
2021-04-04 15:27:57 +03:00
Ariel Mashraki
745afde770 dialect/entsql: add support for column default using annotation
Fixed #1033
2021-04-03 21:53:56 +03:00
Ariel Mashraki
a1ad70c685 dialect/sql/schema: json column migration for mariadb10.3.13
See https://github.com/ent/ent/issues/1395\#issuecomment-809420881
Fixed #1395
2021-03-29 22:34:58 +03:00
Ariel Mashraki
21989f4aa4 entc/gen: chagne column-check error format 2021-03-29 15:29:45 +03:00
Ariel Mashraki
f12ef91829 entc/gen: privatize table columns check 2021-03-29 14:35:38 +03:00
Ariel Mashraki
2d09c8f846 entc/gen/features/multischema: pass schema to count query (#1390)
Fixed #1385
2021-03-25 13:48:32 +02:00
Ariel Mashraki
56a0cf1e8b dialect/sql/sqlgraph: fix incorrect arg-list handling in entql
Fixed #1376
2021-03-22 20:27:12 +02:00
Ariel Mashraki
cf8464cb28 entc/gen/template: allow disable DISTINCT in queries (#1371) 2021-03-22 16:36:05 +02:00
Ariel Mashraki
970887b4d0 entc/gen/template: add extend-templates for all builders (#1364) 2021-03-20 21:46:15 +02:00
Ariel Mashraki
693e8db207 entc/integration: set custom uuid identifier unique on database (#1362) 2021-03-20 18:33:04 +02:00
Ariel Mashraki
b4ad29f7f3 dialect/sql/schema: fix postgres index migration (#1351)
Fix PostgreSQL index migration when table_name = type_name.
Closed #1344
2021-03-18 22:29:39 +02:00
Ariel Mashraki
9685066b83 entc/gen: support on-delete annotation in migrate/schema 2021-03-16 15:29:21 +02:00
Ariel Mashraki
e92dfee33f entc/gen: filter duplicate ids when loading m2m edges 2021-03-16 08:44:27 +02:00
Ariel Mashraki
6ab0d01ea4 entc/gen: filter duplicate ids when loading o2m/m2o edges 2021-03-16 08:44:27 +02:00
Ariel Mashraki
5d70144f44 entc/gen: allow selecting partial fields on update-one 2021-03-14 23:17:30 +02:00
Ariel Mashraki
0cd637ceb2 doc/faq: add examples how to extend the generated builders (#1335) 2021-03-14 14:13:02 +02:00
Ariel Mashraki
76ffcc4adc entc/gen: allow extending config options from global templates (#1334) 2021-03-14 12:21:42 +02:00
Rotem Tamir
36e3492718 dialect/sql/sqlgraph: adding unit tests for IsConstraintError (#1318)
* dialect/sql/sqlgraph: adding unit tests for IsConstraintError group of checks in second phase of #1310

* renaming test for loop variable names

* use backtick strings to improve readability
2021-03-10 18:23:24 +02:00
Rotem Tamir
bc04816c38 entc/gen/template/dialect/sql: cleaning up isSQLConstraintError (#1319)
* entc/gen/template/dialect/sql: cleaning up isSQLConstraintError in generated ent.go to use new sqlgraph IsConstraintError checks.

Adding IsFK and IsUniqueness methods to the generated ent.ConstraintError (on SQL dialects) struct to allow users to glean more information about the specific constraint violation.

Fixes #1310

* fix indentation in tmpl file
regen files
rm new methods from generated code

* regen
2021-03-10 14:07:00 +02:00
森 優太
e52439c5be cmd/ent: fix //go:generate code generation to match go1.16 (#1300)
* doc: fix github link

* doc: fix Link entgo.io -> github.com/ent

* 🎉 first commit

* update go generate style

* doc: update go get to go install

* doc: update versioning with go install

* restore all

* change generate.go content

* add -mod=mod option

* add -mod=mod option
2021-03-09 22:00:33 +02:00
Rotem Tamir
2a17dba983 dialect/sql/sqlgraph: add constraint error checks (#1316)
Initial work on #1310
2021-03-09 15:56:47 +02:00
Ariel Mashraki
e48f2724f5 entc/gen: edge-tag annotation extends json tags (#1315)
Fixed #1302
2021-03-08 16:07:53 +02:00
Ariel Mashraki
c0fd7c1305 entc/gen: add edge-field api for schema and codegen (#1213) 2021-03-07 22:51:17 +02:00
Matthew Gabeler-Lee
c53b45ddb0 all: use %w instead of %v to wrap errors (#1275)
* all: use %w instead of %v for nested errors with fmt.Errorf

* all: update generated code to use %w instead of %v for error wrapping
2021-03-03 20:05:33 +02:00
Ariel Mashraki
3a64e2d20d entc/gen: use edge.owner for checking fk field (#1293)
See issue 1288
2021-03-02 17:42:52 +02:00
Ariel Mashraki
8a8bfe7de6 dialect/sql/sqlgraph: skip setting last-insert-id if was provided (#1291)
Fixed #1290. Issue in BulkCreate(<T>) for m2m edges
2021-03-02 11:59:20 +02:00
Ariel Mashraki
73df26b92b entc/gen: allow setting default-func for id fields (#1290) 2021-03-02 11:41:23 +02:00
Ariel Mashraki
0d0a93b95f entc/gen: add support for referencing fks to existing fields (#1289) 2021-03-01 22:57:32 +02:00
Ariel Mashraki
31bee10942 entc/gen: support zero value as default argument in schema migration (#1287) 2021-03-01 14:42:09 +02:00
Ariel Mashraki
109228f0a3 entc/gen: fix name conflicts in client.tmpl (#1281) 2021-02-26 22:18:54 +02:00
Ariel Mashraki
31ec081b0e entc/gen: fix name conflict in type package (#1274)
Fixed #1268
2021-02-25 14:26:04 +02:00
Pavel Kerbel
3ee6621194 entc/gen: added ability to add comment to schema with external template (#1249)
This change will allow using external tools (such as swagger) to add comments to the schema.
For example, by adding a Swagger annotation to the schema we can add // swagger:model comment.
2021-02-08 13:02:56 +02:00
Ariel Mashraki
15af025dd0 entc/gen: reject schemas whose package conflicts with ent predeclared identifiers (#1244) 2021-02-06 16:17:52 +02:00
Nathaniel Peiffer
96ebbcd627 fix: check names against privateFields (#1239) 2021-02-05 11:49:42 +02:00
zzwx
0f6c71d46b entc/gen: make custom field comment render as additional line(s) (#1234)
* Make custom field comment render as additional line(s)

* Make the test for the comment aware of the new format
2021-02-03 22:23:34 +02:00
Ariel Mashraki
dd4792f5b3 go: rename module from github.com/facebook/ent => entgo.io/ent (#1226) 2021-02-02 23:03:04 +02:00
zzwx
7a2173f20d entc/internal: fix windows filepath separator (#1227) 2021-02-02 19:33:47 +02:00
Ariel Mashraki
3930d3c835 schema/field: implement field.Other (#1218)
* Implement Other Field

* Implement Other Field

* Changed dialect types

* run generate

* doc typo

* docs added

* schema/field: additional validation and tests for Other type

Co-authored-by: Ciaran Liedeman <ciaran@stackworx.io>
2021-01-31 17:43:28 +02:00
Ariel Mashraki
f5158dce55 entc/gen: move schema/snapshot template to its feature-flag (#1211) 2021-01-26 23:13:33 +02:00
Ariel Mashraki
8876d31317 entc/gen: fix feature-flag cleanups (#1210) 2021-01-26 22:31:32 +02:00
Pavel Kerbel
8ca9d55b31 load/schema: added comment to generated schema (#1205) 2021-01-24 22:02:33 +02:00
Ariel Mashraki
2c7228c23f dialect/sql/sqlgraph: add schema for deletion command 2021-01-24 19:57:28 +02:00
Marwan Sulaiman
bdd8f2f624 Ensure SchemaConfig is set in sqlQuery's context (#1203) 2021-01-24 19:57:28 +02:00
Ariel Mashraki
aeb1ccc571 entc/gen: move schemaconfig template to feature-flag 2021-01-24 19:57:28 +02:00
Ariel Mashraki
0e7823383e entc/gen: add default json tag for edge fields (#1204) 2021-01-23 21:23:52 +02:00
Ariel Mashraki
f315801779 dialect/sql/sqlgraph: apply predicate on update-node 2021-01-22 23:04:09 +02:00
Ariel Mashraki
3f57feb63a entc/gen: add external import templates to patterns (#1199) 2021-01-21 13:46:41 +02:00
Marwan Sulaiman
8063d4ac93 entc/gen: add context.Context to to query builder (#1195)
* Add ctx to dialectQuery

* go generate
2021-01-20 11:46:08 +02:00
Marwan Sulaiman
59ffee504d entc/gen: add sql/schemaconfig feature flag (#1194) 2021-01-20 11:43:57 +02:00
Ariel Mashraki
0c2c45f0c6 entc/gen/template: allow override context.Context with custom templates 2021-01-19 10:24:26 +02:00