We're very happy to announce the release of the next version of Ent: v0.11 🎊
This release contains several bug fixes, many small features, and improvements to the ent/schema, ent runtime, and ent codegen. There are 3 major features that were added to the framework: Edge Schemas, GraphQL Schema Generator and a completely new infrastructure for generating schema migrations using Atlas. Please, visit these links to learn more about these new functionalities.
In the next version, we plan to start experimenting with generics to reduce the amount of generated code and may consider exposing new generics-based extensions. Additional tasks that are on our list are query interceptors, polymorphic edges, a toolset for executing migrations safely, and a list of small runtime improvements that exist in our issue tracker.
You are welcome to join our Discord Server, Slack channel and subscribe to the Ent newsletter to get updates on the new features, proposal discussions, and content we release.
What's Changed
dialect/sql/schema: add name to versioned migration files by @imhuytq in https://github.com/ent/ent/pull/2375
schema/field: expose RType.Implements method by @a8m in https://github.com/ent/ent/pull/2379
entc/gen: set Ref and Inverse for edge contains both From and To by @a8m in https://github.com/ent/ent/pull/2380
dialect/sql/schema: add method to create a named versioned migration … by @masseelch in https://github.com/ent/ent/pull/2385
entc/integration: additional schema changes for migration by @a8m in https://github.com/ent/ent/pull/2403
dialect/sql/schema: upgrade atlas and disable sum file creation by @masseelch in https://github.com/ent/ent/pull/2400
dialect/sql: avoid passing bool arguments on bool predicates by @a8m in https://github.com/ent/ent/pull/2405
entc/gen: move column default quoting to template by @a8m in https://github.com/ent/ent/pull/2406
dialect/sql: without foreign keys option for atlas by @zeevmoney in https://github.com/ent/ent/pull/2404
all: drop 1.16 support and run CI on 1.17 and 1.18 by @masseelch in https://github.com/ent/ent/pull/2411
entc/gen: move select and group builders' scan functions to shared struct by @a8m in https://github.com/ent/ent/pull/2412
Update schema-def to use proper method by @fgm in https://github.com/ent/ent/pull/2416
Update getting-started.md by @fgm in https://github.com/ent/ent/pull/2414
entc/gen: use join for loading m2m relationship by @a8m in https://github.com/ent/ent/pull/2417
entc/integration/custom_id: update atlas and fix issue in integration tests by @a8m in https://github.com/ent/ent/pull/2424
dialect/sql/schema: skip creating unique key for primary keys by @a8m in https://github.com/ent/ent/pull/2425
dialect/sql: add support for window functions by @a8m in https://github.com/ent/ent/pull/2431
dialect/sql/schema: prefix sqlite unique indexes with table name by @a8m in https://github.com/ent/ent/pull/2433
entc/gen: allow adding extra fields to the generated edges by @a8m in https://github.com/ent/ent/pull/2437
update example import by @cjraa in https://github.com/ent/ent/pull/2432
Fix incorrect Go code in GoType() doc comments by @fgm in https://github.com/ent/ent/pull/2441
dialect/sql: support for order by expressions in window functions by @a8m in https://github.com/ent/ent/pull/2442
entc/gen: block Optional on the ID field by @giautm in https://github.com/ent/ent/pull/2443
gen/entc/template: add option to process nodes after query using external templates by @a8m in https://github.com/ent/ent/pull/2444
dialect/sql/schema: init db version before executing diff by @CharlesGe129 in https://github.com/ent/ent/pull/2440
New Contributors
@imhuytq made their first contribution in https://github.com/ent/ent/pull/2375
@fgm made their first contribution in https://github.com/ent/ent/pull/2416
@iwata made their first contribution in https://github.com/ent/ent/pull/2415
@CharlesGe129 made their first contribution in https://github.com/ent/ent/pull/2440
@carlos0202 made their first contribution in https://github.com/ent/ent/pull/2459
@dorlib made their first contribution in https://github.com/ent/ent/pull/2464
@thmeitz made their first contribution in https://github.com/ent/ent/pull/2482
@booleangate made their first contribution in https://github.com/ent/ent/pull/2525
@eltociear made their first contribution in https://github.com/ent/ent/pull/2527
@stoikheia made their first contribution in https://github.com/ent/ent/pull/2566
@frederikhors made their first contribution in https://github.com/ent/ent/pull/2593
@hax10 made their first contribution in https://github.com/ent/ent/pull/2633
@willbicks made their first contribution in https://github.com/ent/ent/pull/2632
@smizuno2018 made their first contribution in https://github.com/ent/ent/pull/2663
@seawolf made their first contribution in https://github.com/ent/ent/pull/2687
@nikitavoloboev made their first contribution in https://github.com/ent/ent/pull/2690
@gmhafiz made their first contribution in https://github.com/ent/ent/pull/2520
@Liooo made their first contribution in https://github.com/ent/ent/pull/2735
@nine-hundred made their first contribution in https://github.com/ent/ent/pull/2746
Full Changelog: https://github.com/ent/ent/compare/v0.10.1...v0.11
entc/gen: add the sql/execquery feature flag by @a8m in https://github.com/ent/ent/pull/2447
entc/integration/migrate: update atlas and test custom time precision by @a8m in https://github.com/ent/ent/pull/2462
dialect/sql/schema: option to enable atlas sum file by @masseelch in https://github.com/ent/ent/pull/2470
entc/gen: expose config on generated filters by @a8m in https://github.com/ent/ent/pull/2473
entc/gen: skip Table() predicate and warn about reserved schema name (Client) by @masseelch in https://github.com/ent/ent/pull/2486
entc/integration/migrate: add example for renaming columns by @a8m in https://github.com/ent/ent/pull/2496
entc/integration/json: add example for using interfaces in JSON fields by @a8m in https://github.com/ent/ent/pull/2497
gen/template: allow overriding of client struct and initialization by @masseelch in https://github.com/ent/ent/pull/2503
dialect/sql: add New method to pass in a river without opening a *sql… by @masseelch in https://github.com/ent/ent/pull/2504
dialect/sql: support string based pk for mysql56 indexes (prevent err… by @masseelch in https://github.com/ent/ent/pull/2506
entc/gen/template/sql/feature: add comment to feature field on config… by @masseelch in https://github.com/ent/ent/pull/2515
Fix propagating post-save mutations by @booleangate in https://github.com/ent/ent/pull/2525
dialect/sql/schema: respect sumfile when present and do not operate on checksum mismatch by @masseelch in https://github.com/ent/ent/pull/2522
Sub queries by @crossworth in https://github.com/ent/ent/pull/2509
entc/gen: add conditional-write option to external templates by @a8m in https://github.com/ent/ent/pull/2542
go: update ariga.io/atlas to latest master by @a8m in https://github.com/ent/ent/pull/2555
feat: add Nil/NotNil predicates by @giautm in https://github.com/ent/ent/pull/2556
ent: initial support for edge schemas by @a8m in https://github.com/ent/ent/pull/2560
go: update ariga.io/atlas to latest master by @a8m in https://github.com/ent/ent/pull/2567
update sqlite3 driver from 1.14.10 to 1.14.13 by @stoikheia in https://github.com/ent/ent/pull/2566
entc/gen: avoid setting the incremental attribute fo non-integer fields by @a8m in https://github.com/ent/ent/pull/2571
dialect/sql: fixed wrong UserDefined checks by @giautm in https://github.com/ent/ent/pull/2572
dialect/sql/sqlgraph: better support for update nodes with predicates by @a8m in https://github.com/ent/ent/pull/2574
entc/gen: support indexing edge schema with composite primary keys by @a8m in https://github.com/ent/ent/pull/2578
ci: bump golangci-lint version by @sashamelentyev in https://github.com/ent/ent/pull/2577
Do not refer to SQLite3 anymore by @frederikhors in https://github.com/ent/ent/pull/2593
entc/gen: move a8m/entclean logic to ent by @a8m in https://github.com/ent/ent/pull/2612
refactor: rename annotation vars by @sashamelentyev in https://github.com/ent/ent/pull/2614
Use fmt.Errorf instead of errors.Wrapf by @frederikhors in https://github.com/ent/ent/pull/2608
entc/gen: change codegen signature from entc to ent by @a8m in https://github.com/ent/ent/pull/2627
Fix compile error caused by entc template when Entity name has initials TX by @hax10 in https://github.com/ent/ent/pull/2633
dialect/sql/schema: introduce type store interface by @masseelch in https://github.com/ent/ent/pull/2636
feat: improve generated comments by @willbicks in https://github.com/ent/ent/pull/2632
entc/gen: fixed unnamed field initialization by @giautm in https://github.com/ent/ent/pull/2648
dialect/sql/schema: file based type store by @masseelch in https://github.com/ent/ent/pull/2644
go: update atlas and test for global-unique-id migration by @a8m in https://github.com/ent/ent/pull/2661
entc/gen: catch constraint failures in delete operations by @a8m in https://github.com/ent/ent/pull/2664
entc/gen: allow opening and testing concurrent enttest clients by @a8m in https://github.com/ent/ent/pull/2665
ci: remove unnecessary build flag from go test by @a8m in https://github.com/ent/ent/pull/2672
entc/gen: use gotype pkgname as alias in case it does not match pkgpath by @a8m in https://github.com/ent/ent/pull/2686
Update comment typo in group.go by @seawolf in https://github.com/ent/ent/pull/2687
entc/gen: support default id values for edge schemas by @a8m in https://github.com/ent/ent/pull/2688
Add info about using WhereInput in with .Where() by @frederikhors in https://github.com/ent/ent/pull/2691
schema/field: support for sensitive json fields by @a8m in https://github.com/ent/ent/pull/2701
dialect/sql/schema: setup tables before running migrate diff by @a8m in https://github.com/ent/ent/pull/2703
improve multi-tenancy example and documentation by @a8m in https://github.com/ent/ent/pull/2705
entc/gen: skip nodes with composite id types on default id-type detection by @a8m in https://github.com/ent/ent/pull/2708
entc: cleanup defaults ID by @giautm in https://github.com/ent/ent/pull/2709
dialect/sql/sqlgraph: support edge-schema in upsert by @a8m in https://github.com/ent/ent/pull/2714
Fix problem when model maps integer id to a GoType by @stoikheia in https://github.com/ent/ent/pull/2657
dialect/sql/schema: atlas engine is now default by @masseelch in https://github.com/ent/ent/pull/2698
dialect/sql/sqlgraph: handle edge schema in batch inserts by @a8m in https://github.com/ent/ent/pull/2718
entc/gen: ignore edge-fields order in edge-schema with composite identifiers by @a8m in https://github.com/ent/ent/pull/2719
entc/gen: improve edge-schema updates by @a8m in https://github.com/ent/ent/pull/2726
all: update atlas by @masseelch in https://github.com/ent/ent/pull/2739
dialect/sql/builder: make sql.In() with empty args fallback to False() by @Liooo in https://github.com/ent/ent/pull/2735
entc/gen: edge schema with custom ids by @a8m in https://github.com/ent/ent/pull/2742
entc/gen: support edgeschema with privacy by @a8m in https://github.com/ent/ent/pull/2745
sql/dialect/schema: support setting PK to serial types in postgres by @a8m in https://github.com/ent/ent/pull/2748