Commit Graph

730 Commits

Author SHA1 Message Date
MasseElch
4e434b2b73 gen/template: allow overriding of client struct and initialization (#2503) 2022-04-28 09:07:44 +02:00
Ariel Mashraki
879bb8a905 entc/integration/json: add example for using interfaces in JSON fields (#2497) 2022-04-25 13:34:05 +03:00
Ariel Mashraki
04e0dc936b entc/integration/migrate: add example for renaming columns (#2496) 2022-04-24 22:36:33 +03:00
MasseElch
2c8e58ce94 entc/gen: skip Table() predicate and warn about reserved schema name (Client) (#2486)
* entc/gen: do no generate `Table()` predicate and warn the user in case of reserved schema name like `Client`.

* doc/md: document reserved schema name

* doc/md: revert reserved schema name as this was already working

* doc/md: rephrase
2022-04-20 16:30:59 +02:00
Ariel Mashraki
4cf6dd75ec entc/gen: expose config on generated filters (#2473) 2022-04-14 20:00:52 +03:00
MasseElch
c1175719a2 dialect/sql/schema: option to enable atlas sum file (#2470)
* dialect/sql/schema: option to enable atlas checksum file

* entc/integration/migrate: add integration tests for versioned migrations

* entc/integration/migrate: apply CR
2022-04-13 21:36:57 +02:00
Ariel Mashraki
6e4e4da896 entc/integration/migrate: update atlas and test custom time precision (#2462) 2022-04-08 11:27:30 +03:00
Ariel Mashraki
d92984f744 doc/website: add sql/execquery feature-flag to document (#2453) 2022-04-06 14:10:33 +03:00
Ariel Mashraki
89c339209e entc/gen: add the sql/execquery feature flag (#2447) 2022-04-06 13:34:22 +03:00
Ariel Mashraki
05246cbd26 gen/entc/template: add option to process nodes after query using external templates (#2444) 2022-04-02 22:01:28 +03:00
Giau. Tran Minh
196875c761 entc/gen: block Optional on ID fields (#2443)
* entc/gen: block Optional on the ID field

* chore: restore the old error message

* Update entc/gen/type.go

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

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2022-04-02 21:01:38 +03:00
Ariel Mashraki
345d3d1783 dialect/sql: support for order by expressions in window functions (#2442) 2022-04-01 21:31:00 +03:00
Ariel Mashraki
48bb70f056 entc/gen: allow adding extra fields to the generated edges (#2437) 2022-03-29 14:54:16 +03:00
Ariel Mashraki
317594ec80 dialect/sql/schema: prefix sqlite unique indexes with table name (#2433)
Fixed https://github.com/ent/ent/issues/2421
2022-03-28 12:54:39 +03:00
Ariel Mashraki
92ff734815 dialect/sql: add support for window functions (#2431) 2022-03-27 20:53:36 +03:00
Ariel Mashraki
6c30ca7d4f dialect/sql/schema: skip creating unique key for primary keys (#2425) 2022-03-24 18:53:36 +02:00
Ariel Mashraki
c00b4ecb0f entc/integration/custom_id: update atlas and fix issue in integration tests (#2424) 2022-03-24 17:55:55 +02:00
Ariel Mashraki
edd968490e entc/gen: use join for loading m2m relationship (#2417)
* entc/gen: use join for m2m relationship

* entc/gen: add test for eager-load inverse-m2m
2022-03-21 11:37:54 +02:00
Ariel Mashraki
a7c1df2d0a entc/gen: move selectbuilder scan functions to shared struct (#2412) 2022-03-18 07:59:04 +02:00
Ariel Mashraki
9bb800105d doc/hook: additional example for rejecting op (#2407) 2022-03-16 16:09:04 +02:00
Ariel Mashraki
c071898395 entc/gen: move column default quoting to template (#2406) 2022-03-16 13:41:19 +02:00
Ariel Mashraki
412947d274 dialect/sql: avoid passing bool arguments on bool predicates (#2405) 2022-03-15 22:52:49 +02:00
Ariel Mashraki
3f0b0856fd entc/integration: additional schema changes for migration (#2403) 2022-03-15 18:32:38 +02:00
MasseElch
2853afc1dc dialect/sql/schema: add method to create a named versioned migration … (#2385)
* dialect/sql/schema: add method to create a named versioned migration file

* doc/md: documentation for named versioned migrations

* entc/gen/template/dialect/sql/feature: add NamedDiff method to create named versioned migration files

* all: go generate

* doc/md: apply CR
2022-03-10 16:40:57 +01:00
Ariel Mashraki
0c7679e571 entc/gen: set Ref and Inverse for edge contains both From and To 2022-03-08 22:28:50 +02:00
Ariel Mashraki
3aab4d91c2 all: update atlasgo.io to latest (#2376) 2022-03-04 22:53:37 +02:00
Ariel Mashraki
35a098fdbb dialect/sql/schema: fix bug in atlas integration when working WithDropIndex/WithDropColumn (#2374)
* dialect/sql/schema: fix no change condition in atlas

* dialect/sql/schema: fix bug in atlas integration when working WithDropIndex/WithDropColumn

Co-authored-by: Zeev Manilovich <zeevmanilovich@gmail.com>
2022-03-03 21:52:44 +02:00
Ariel Mashraki
36a1063c7e entc/integration/migrate: add FULLTEXT usage example 2022-02-22 16:24:30 +02:00
Ariel Mashraki
fe2511fc8d dialect/entsql: add support for index-type annotation 2022-02-22 16:24:30 +02:00
MasseElch
d80f7cc41a entc/gen: singularize feature flag name for versioned migrations (#2350) 2022-02-21 20:06:32 +01:00
MasseElch
0239daca7b dialect/sql/schema: versioned migrations (#2337)
* dialect/sql/schema: fix go doc

* all: update atlas

* dialect/sql/schema: diff connected DB and defined schema and write changes to migration file

* dialect/sql/schema: use migration directory and formatter directly instead of a planner

* all: update atlas

* cmd: add command to create a new migration file

* entc/gen: generate main.go with migrate diff example

* all: regenerate

* cmd/internal/base: make linter happy

* all: support Go 1.16 in versioned migrations main.go

* entc/gen: put versioned migrations behind feature flag

* all: regenerate

* cmd/ent: driver-prefixed dsn in migrate diff command

* cmd/internal/base: remove prefix from migrate import

* cmd/internal/base: use cobra.CheckErr

* cmd: remove diff command

* entc/gen/template/dialect/sql/feature: remove generated main.go

* all: rebase on master and go mod tidy

* all: regenerate
2022-02-21 12:15:17 +02:00
Pedro Henrique
24a7e78d49 entc/gen: skip assertion on edges with type Other (#2335) 2022-02-18 00:37:16 +02:00
MrParano1d
a75e9c5a8f entc/gen: fix missing unique field in query builder template (#2332)
* fix(query): fix missing unique field in query builder template

when a query gets cloned the unique field doesn't get cloned

#2331

* fix(query): added missing go generate ./...

#2331

* fix(query): added missing go generate ./...

#2331
2022-02-15 22:31:05 +02:00
Pedro Henrique
f45d29ba4b entc/gen: allow if field to use field.Other with custom types (#2309)
* fix ID with field.Other comparing with zero

* fix lint

* Update entc/integration/customid/ent/schema/other.go

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

* re-generate code

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2022-02-10 16:17:16 +02:00
Ariel Mashraki
770e4d24e9 entc/gen: add Type.IsInt64 helper function for fields 2022-02-04 22:46:17 +02:00
Ariel Mashraki
1d3f1819ae entc/gen: replace Type.Alias with Type.PackageAlias 2022-02-04 22:46:17 +02:00
Ariel Mashraki
0e49dd1d9f entc/gen: support local package names for generated packages
The new Alias option adds package aliases (local names) for all type-packages that
their import identifier conflicts with user-defined packages (i.e. GoType).
2022-02-02 15:50:00 +02:00
Ariel Mashraki
51663407cf dialect/sql/schema: support DESC indexes using atlasgo.io 2022-01-31 15:18:09 +02:00
Ariel Mashraki
94499bd141 dialect/entsql: add support for DESC indexes annotation 2022-01-31 15:18:09 +02:00
Zhizhen He
9da36e461f all: fix typos (#2301) 2022-01-29 10:30:31 +02:00
Ariel Mashraki
f8c0f02803 schema/field: add support for type-aware Default and UpdateDefault in time fields (#2289) 2022-01-24 14:27:57 +02:00
Ariel Mashraki
898991ac79 entc/gen: set foreign-key columns non-nullable for required edges (#1703)
Note, this only applies to edges without circular references.
Fixed #1688 and #1374
2022-01-23 22:23:37 +02:00
Nicholas Anderson
896f2b202d entc/gen: update NotSingularError godoc (#2274)
* fix: update only/onlyID comments

this patch updates the Only/OnlyID methods in the builder template from:

> // Returns a *NotSingularError when exactly one {{ $.Name }} entity is not found.
to
> // Returns a *NotSingularError when more than exactly one {{ $.Name }} ID is found.

in an effort to be more explicit in the explanation of the behavior of the methods.

* fix: update wording to be more concise from suggestion

Co-authored-by: Rotem Tamir <rotemtamir@gmail.com>

* fix: update Only wording to be more concicse

* fix: generate new files

Co-authored-by: Rotem Tamir <rotemtamir@gmail.com>
2022-01-23 19:07:10 +02:00
Ariel Mashraki
60e03285d0 dialect/sql/schema: hello ariga.io/atlas (#2279) 2022-01-20 17:20:50 +02:00
Clarence
eca70b8490 schema/field: array types are nillable (#2266)
* all: type fixes

* schema/field: remove array check from goType
2022-01-13 13:39:11 +02:00
Genevieve
16e57a92c5 entc/gen: spelling fix in error message (#2262) 2022-01-13 12:51:37 +02:00
Ariel Mashraki
08ba217a28 entc/integration: rename uuid to optional_uuid to allow nillable setters for array types (#2264) 2022-01-13 12:41:35 +02:00
Roman Maklakov
84070a0f07 entc/gen: add ctx in client.BeginTx (#2260)
* doc: fix docker-compose up command(#2253)

* entc/gen: add ctx in TxBegin & run go generate (#2253)

* entc/integration: add tests for TxBegin Commit and Rollback (#2253)

* entc/integration: uncomment accidentally commented code(#2253)

* entc/integration: fixes after code-review (#2253)

* entc/integration: remove blank lines, code-review (#2253)

* examples: run code gen  (#2253)
2022-01-12 14:28:55 +02:00
Sasha Melentyev
f5fed28782 all: fix typos (#2243)
* refactor(all): Fix typo and small refactor

* refactor(all): Fix typo
2022-01-05 16:10:28 +02:00
MasseElch
84ca961938 entc/gen: there was a typo in Ty interfaces (#2251) 2022-01-05 16:09:48 +02:00