Commit Graph

1701 Commits

Author SHA1 Message Date
Charles Ge
e463cbca55 init db version before executing diff (#2440)
What's the problem: Under versioned migration on MySQL 8.0, unique string field would be generated as type varchar(191) instead of varchar(255). This is because in generating migration files by NamedDiff(), sqlDialect's init() method is not called. 

Further concern: For init() function, MySQL and Postgres's implementation checks the database version which is what I want. But SQLite's implementation checks the foreign_keys support. So I think there might be a better may to check the database version before doing Diff().
2022-04-06 09:43:13 +02: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
Frédéric G. MARAND
110d0d138a ent/schema/field: fix incorrect Go code in GoType() doc comments (#2441)
All examples used repeated argument names, which do not compile
2022-04-01 19:35:23 +03:00
Clarence
21ea376817 update example import (#2432) 2022-03-31 12:55:54 +02: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
cb7e0c1f1b doc/tutorial: add title with file names to code blocks (#2430) 2022-03-26 18:49:04 +03:00
allcontributors[bot]
a89d1ec40f docs: add iwata as a contributor for doc (#2427)
* docs: update doc/md/contributors.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-03-25 16:17:06 +01:00
Motonori Iwata
e1e47e61f3 Write a document for custom formatter of migrate (#2415)
* Write a document for custom formatter of migrate

closes https://github.com/ent/ent/issues/2408

* Update doc/md/versioned-migrations.md

Co-authored-by: MasseElch <12862103+masseelch@users.noreply.github.com>

* Update doc/md/versioned-migrations.md

Co-authored-by: MasseElch <12862103+masseelch@users.noreply.github.com>

* more helpful code snippet

* Update doc/md/versioned-migrations.md

Co-authored-by: MasseElch <12862103+masseelch@users.noreply.github.com>

* Update doc/md/versioned-migrations.md

Co-authored-by: MasseElch <12862103+masseelch@users.noreply.github.com>

* Update doc/md/versioned-migrations.md

Co-authored-by: MasseElch <12862103+masseelch@users.noreply.github.com>

Co-authored-by: MasseElch <12862103+masseelch@users.noreply.github.com>
2022-03-25 16:13:22 +01: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
Amit Shani
71020f8d7b doc/website/blog: tidb indentation fix (#2423) 2022-03-24 15:07:38 +02:00
Ariel Mashraki
55ed0508c7 doc: minor impronments to getting-started (#2422) 2022-03-24 12:42:57 +02:00
dependabot[bot]
e20e658cdd build(deps): bump actions/cache from 2.1.7 to 3 (#2420)
Bumps [actions/cache](https://github.com/actions/cache) from 2.1.7 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.7...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-24 10:45:38 +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
Frédéric G. MARAND
938233b191 doc: update installation in getting-started (#2414)
since Go 1.18 `go get` is no longer the way to download a command for any supported version: updated to use go install instead.
2022-03-20 11:47:06 +02:00
Frédéric G. MARAND
0d9173c0b9 doc: update schema-def to use proper method (#2416)
The exemple incorrectly adds an ignored `User.Index` method, although ent actually needs a `User.Indexes` method as part of `ent.Interface`
2022-03-20 11:46:06 +02:00
Ariel Mashraki
a7c1df2d0a entc/gen: move selectbuilder scan functions to shared struct (#2412) 2022-03-18 07:59:04 +02:00
MasseElch
286eec4b38 all: drop 1.16 support and run CI on 1.17 and 1.18 (#2411) 2022-03-17 17:30:13 +01:00
Rotem Tamir
865ddb8d47 doc/website/blog: small fixes 2022-03-17 14:54:57 +02:00
Amit Shani
683fe8cc3b doc/website/blog: TiDB announcement (#2396) 2022-03-17 14:42:15 +02:00
Zeev Manilovich
b1abbd3d65 dialect/sql/schema: without foreign keys option for atlas (#2404)
* dialect/sql: without foreign key option for atlas

* handle fks in modifytables

* add tests

* tests

* Update dialect/sql/schema/atlas.go

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

* ct and tests

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2022-03-16 17:27:23 +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
MasseElch
db1617bb29 dialect/sql/schema: upgrade atlas and disable sum file creation (#2400)
* dialect/sql/schema: upgrade atlas and disable sum file creation

* dialect/sql/schema: linter
2022-03-15 17:40:56 +01:00
Ariel Mashraki
3f0b0856fd entc/integration: additional schema changes for migration (#2403) 2022-03-15 18:32:38 +02:00
MasseElch
41db628df3 doc/website/blog: versioned migrations (#2387)
* doc/md: clarify when feature flag is needed for versioned migrations

* doc/website/blog: introduction

* doc/md: more blog post

* Apply suggestions from code review

Co-authored-by: Hila Kashai <73284641+hilakashai@users.noreply.github.com>

* doc/website/blog: move explanation about versioned migration purpose up

* doc/website/blog: apply CR

* doc/website/blog: reword desription of versioned migrations

* doc/website/blog: typos

* doc/website/blog: last minute changes pre publish

Co-authored-by: Hila Kashai <73284641+hilakashai@users.noreply.github.com>
2022-03-14 14:47:13 +01:00
dependabot[bot]
7328355e17 build(deps): bump github.com/spf13/cobra from 1.3.0 to 1.4.0 (#2386)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spf13/cobra/compare/v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-14 10:21:43 +02:00
Amit Shani
a27f753bc8 go: upgrade atlas for tidb support (#2394) 2022-03-13 17:08:50 +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
allcontributors[bot]
342088fcce docs: add maorlipchuk as a contributor for code (#2381) 2022-03-08 23:32:13 +02: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
78a0fd9716 schema/field: expose RType.Implements method (#2379)
Also, add both (T) and (*T) methods for RType
2022-03-07 22:33:50 +02:00
allcontributors[bot]
a1a7cd8114 docs: add imhuytq as a contributor for code (#2378)
* docs: update doc/md/contributors.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-03-07 10:19:30 +01:00
Huy TQ
ddddc1d92a dialect/sql/schema: add name to versioned migration files (#2375)
* add name to versioned migration files

* Skip writing migration files if the plan has no changes
2022-03-07 10:18:07 +01:00
Ariel Mashraki
3aab4d91c2 all: update atlasgo.io to latest (#2376) v0.10.1 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
dependabot[bot]
8753baae78 build(deps): bump actions/checkout from 2.4.0 to 3 (#2372)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.0 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.4.0...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-03 18:37:58 +02:00
dependabot[bot]
25ebdebcf1 build(deps): bump actions/setup-node from 2.5.1 to 3 (#2365)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2.5.1 to 3.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.5.1...v3)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-28 21:20:25 +02:00
MasseElch
8f213a4d4f doc/website/blog: ogent is using main instead of master (#2367) 2022-02-28 09:34:24 +01:00
Jeffrey Stiles
4213c72699 entc/integration: add required json1 build tag to contributing instructions (#2359)
Co-authored-by: Jeffrey Stiles <freb@users.noreply.github.com>
2022-02-25 09:12:20 +02:00
MasseElch
b17aa2245f doc/md: prettier URL for versioned migrations doc part 2 (#2361) 2022-02-24 08:30:46 +01:00
MasseElch
5ff2256e10 doc/md: prettier URL for versioned migrations doc (#2360) 2022-02-24 08:18:24 +01:00
Ariel Mashraki
feac4d8536 doc/indexes: add annotations supported by atlasgo.io 2022-02-22 16:55:07 +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