Commit Graph

191 Commits

Author SHA1 Message Date
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
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
Thomas Prebble
ce9641e1ae dialect/sql/schema: support postgres geometric types (#2340) 2022-02-18 17:08:25 +02:00
Ariel Mashraki
51663407cf dialect/sql/schema: support DESC indexes using atlasgo.io 2022-01-31 15:18:09 +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
Ariel Mashraki
60e03285d0 dialect/sql/schema: hello ariga.io/atlas (#2279) 2022-01-20 17:20:50 +02:00
s-takehana
0fd6143979 dialect/sql/schema: support time with time zone and time without time zone (#2257)
* dialect/sql/schema: support `time with time zone` and `time without time zone`

* fix test

* fix test
2022-01-12 14:33:26 +02:00
Ariel Mashraki
6848f3fc7b dialect/sql/schema: do not sort primary-key columns before diff (#2254)
PKs are indexes and therefore, the order does matter.
Thanks to ariga.io/atlas we found this issue.
2022-01-09 15:37:21 +02:00
Mehmet Yılmaz
4d01a56b8d dialect/sql/schema: allow adding DEFAULT to columns on migration #1758 (#2199)
* add feature to SET DEFAULT value when add new default value to a existing column

* refactoring unit tests

* correct misspells

* code review refactors

* refactors

* Update dialect/sql/schema/postgres.go

* Update dialect/sql/schema/postgres.go

* Update dialect/sql/schema/postgres.go

* Update dialect/sql/schema/postgres.go

* Update dialect/sql/schema/postgres.go

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2021-12-20 11:29:07 +02:00
Mehmet Yılmaz
8a6ff230c8 dialect/sql/schema: convert column type string to lower case (#2222)
Fixed #2209

* convert column type string to lower case

* Update dialect/sql/schema/sqlite.go

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2021-12-19 21:02:06 +02:00
Yoni Davidson
b8149f2768 dialect/schema: support float for mysql on inspection (#2191)
* dialect/schema: support float for mysql

* add tests
2021-12-07 12:45:46 +02:00
Ariel Mashraki
475e237937 dialect/sql/schema: fix bug when using multiple table CHECK constraints (#2188)
Fixed https://github.com/ent/ent/issues/2185
2021-12-01 12:00:06 +02:00
Naor Matania
8847a1ac55 dialect/sql/schema: fix migrating Postgres fields with max character varchar custom type (#2162)
* Support migration of varying length varchar postgres

* update type

* fix type

* improve type

* remove not needed change

* fix failing test

* add inspect test

* add more tests

* go fmt

* fix pr comment
2021-11-28 07:57:57 +02:00
Ariel Mashraki
dd6c034c2a dialect/sql/schema: support mediumtext field in migration
Fixed https://github.com/ent/ent/issues/2113
2021-11-07 15:37:06 +02:00
Alexander Melentyev
147b1f59ae all: small typo fixes (#2095) 2021-11-01 17:47:06 +02:00
Ariel Mashraki
f30a17edd4 all: fix linting issues before migrating to golangci v1.42 (#2019) 2021-10-07 19:54:43 +03:00
Shen Yang
65cf307b10 dialect/sql/schema: add support for tstzrange and interval and in postgres (#2013)
Fixes #1989
2021-10-06 21:46:34 +03:00
Ariel Mashraki
14cba0abb6 dialect/sql/schema: make Field.Unique and Index.Unique equal (#2004)
This will allow moving from:

	field.String(c).Unique()

To:

	index.Field(c).Unique()

And vice versa
2021-10-03 16:20:28 +03:00
Ariel Mashraki
4c2faf2282 entc/gen: allow spaces in enum fields 2021-09-23 23:23:28 +03:00
storyicon
779594f7da dialect/sql/schema: support mysql mediumtext type (#1972)
Signed-off-by: storyicon <yuanchao@bilibili.com>
2021-09-22 15:35:14 +03:00
Ariel Mashraki
5c7c36bf29 dialect/sql/schema: skip parsing expression default for postgres
Fixed https://github.com/ent/ent/issues/1962
2021-09-21 15:59:04 +03:00
Ariel Mashraki
38925b6134 dialect/sql/schema: revert #1547 for mariadb 2021-09-14 13:07:49 +03:00
dakimura
dac5ccaec9 dialect/sql/schema: fix error message for the missing fk constraints (#1861) 2021-08-22 22:05:40 +03:00
Ariel Mashraki
397b3e984d dialect/sql/schema: setup tables before execute hooks 2021-08-04 21:43:00 +03:00
Ariel Mashraki
79716e47d0 dialect/sql/schema: remove unneeded nolint rule 2021-07-16 14:07:40 +03:00
Ruben de Vries
1ea718f7bf dialect/sql/schema: add support for postgres and mysql numeric and decimal types in migrations (#1721)
* improve error message when failing to generate changeset

* support migrations for postgres and mysql numeric fields
2021-07-16 13:57:53 +03:00
bshihr
4066255641 dialect/sql/schema: add IndexBuilder.IfNotExists and use for Create() case. (#1666)
Append-only mode creates tables with the `IF NOT EXISTS` annotation.
Make indices case symmetric with this.
2021-06-30 09:09:48 +03:00
Ariel Mashraki
7ffdce4cef sql/schema: support custom char type for field.Other
Fixed #1664
2021-06-29 16:31:57 +03:00
Ariel Mashraki
c40ae45aee entc/gen: add support for summing custom Go numeric types 2021-06-25 17:30:17 +03:00
Ariel Mashraki
1d661deb50 dialect/sql/schema: add mysql tests for checks annotation 2021-06-18 10:30:07 +03:00
Ariel Mashraki
42a2c67cc4 dialect/entsql: add support for table checks in schema/migration 2021-06-17 23:22:37 +03:00
Ariel Mashraki
66871c9806 dialect/sql/schema: add support for index prefixes in mysql 2021-06-09 22:52:31 +03:00
Ariel Mashraki
7428167a14 dialect/sql/schema: add testcase for unsigned decimal types (#1628) 2021-06-08 11:22:55 +03:00
Ariel Mashraki
f7db15ccbb dialect/sql/schema: add field collation support for postgres 2021-05-10 20:32:45 +03:00
Mahmudul Haque
ba954ebeec dialect/sql/schema: add field collation support (#1548)
* specific field collation support

* go generate ./...
2021-05-09 18:09:08 +03:00
Ariel Mashraki
37d4b9e2cb dialect/sql/schema: do not set timestamp to nullable columns on MySQLv8.* (#1547)
Fixed #1541
2021-05-08 21:29:35 +03:00
陈杨文
be59ad6d3f dialect.sql/schema.Column ScanDefault allowed uuid default to function (#1537) 2021-05-07 16:15:29 +03:00
AlonDavidBehr
110bfd97ca dialect/sql/schema: fixed spelling mistakes in schema.go (#1532) 2021-05-03 21:02:52 +03:00
Ciaran Liedeman
b20d521593 dialect/sql/schema: added foreign keys to postgres inspect (#1493)
* Added foreign keys to postgres inspect

* Update dialect/sql/schema/inspect.go

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

* Update dialect/sql/schema/inspect.go

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

* added unit test

* fixed interface

* moved import back

* fixing tests

* Update dialect/sql/schema/inspect.go

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

* Update dialect/sql/schema/postgres.go

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

* Update dialect/sql/schema/postgres.go

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

* pr feedback

* added m2m test case

* converted to unit tests

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2021-04-26 15:32:12 +03:00
Vojtěch Káně
43ef74b8a8 entc/gen: add support for default annotation to PKs as well (#1492) 2021-04-22 14:16:53 +03:00
Christoph Hartmann
5421d6c628 dialect/sql/schema: handle pg bytea for schema changes (#1462) 2021-04-19 14:46:01 +03:00
Ariel Mashraki
5bcee6b51c dialect/sql/schema: add postgres tests for array type 2021-04-14 14:25:28 +03:00
Ariel Mashraki
fd1f2df150 dialect/sql/schema: add support for pg arrays in migration 2021-04-14 14:25:28 +03:00
bshihr
d7b683c0d3 dialect/sql/schema: correct wrong error message ("mysql" hard coded in Inspector method) (#1442) 2021-04-09 07:40:31 +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
305edd00e0 dialect/sql/schema: handle index prefix key limit in older versions of mariadb
Fixed #1378
2021-03-23 17:01:38 +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