Commit Graph

81 Commits

Author SHA1 Message Date
Jannik Clausen
c41d223733 dialect/sql/schema: disable foreign keys before opening a transaction (#2966)
* dialect/sql/schema: disable foreign keys before opening a transaction

* dialect/sql/schema: disable foreign keys before opening a transaction

* fix tests

* add test for bug

* apply CR
2022-09-28 07:41:49 +02:00
Ariel Mashraki
2c63d1d70e all: gofmt -w -r 'interface{} -> any' (#2874) 2022-08-19 18:23:04 +03:00
Jannik Clausen
412f5f75ca add docs about auto-increment counter "bug" in MySQL versions < 8.0 and how to handle it (#2722) 2022-07-06 10:34:39 +02:00
Jannik Clausen
7017cbc898 dialect/sql/schema: file based type store (#2644)
* dialect/sql/schema: file based type store

This PR adds support for a file based type storage when using versioned migrations. The file called `.ent_types` is written to the migration directory alongside the migration files and will be kept in sync for every migration file generation run.

In order to not break existing code, where the type storage might differ for different deployment, global unique ID mut be enabled by using a new option. This will also be raised as an error to the user when attempting to use versioned migrations and global unique ID.

Documentation will be added to this PR once feedback on the code is gathered.

* apply CR

* fix tests

* change format of types file to exclude it from atlas.sum file

* docs and drift test

* apply CR
2022-06-15 16:10:15 +02:00
MasseElch
e50d335c30 dialect/sql: support string based pk for mysql56 indexes (prevent err… (#2506)
* dialect/sql: support string based pk for mysql56 indexes (prevent error 1071)

* Update entc/integration/customid/ent/schema/revision.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-29 08:57:22 +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
Ariel Mashraki
60e03285d0 dialect/sql/schema: hello ariga.io/atlas (#2279) 2022-01-20 17:20:50 +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
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
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
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
38925b6134 dialect/sql/schema: revert #1547 for mariadb 2021-09-14 13:07:49 +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
Ariel Mashraki
7ffdce4cef sql/schema: support custom char type for field.Other
Fixed #1664
2021-06-29 16:31:57 +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
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
Ariel Mashraki
fd1f2df150 dialect/sql/schema: add support for pg arrays in migration 2021-04-14 14:25:28 +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
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
a0c3976ee5 dialect/sql/schema: add mysql spatial type for migration (#1271) 2021-02-24 22:24:42 +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
Ariel Mashraki
95d780e55e dialect/sql/schema: add mysql text for column scan (#1219) 2021-01-31 22:25:38 +02:00
Ariel Mashraki
cc8da8fbf7 dialect/sql/schema: schema match from predicate 2021-01-18 12:38:39 +02:00
Ariel Mashraki
8b798d2714 dialect/sql/schema: add tables inspection capabilities (#1178) 2021-01-17 16:41:07 +02:00
Ariel Mashraki
601a4ee50d dialect/sql/schema: support alternate schema for drivers (#1167) 2021-01-13 14:21:03 +02:00
Ariel Mashraki
2aad872da5 dialect/sql/schema: combine binary and varbinary to one clause (#1140) 2021-01-06 15:28:26 +02:00
Noah-Jerome Lotzer
d384b3ecc4 dialect/sql/schema: add mysql binary support for native uuid handling in 8.0+ (#1085) 2021-01-06 14:47:41 +02:00
Ariel Mashraki
7e3d5fdfb5 dialect/sql/schema: add support for json migration in older versions of mariadb (#1066) 2020-12-20 11:11:22 +02:00
Ariel Mashraki
86b9d850ee dialect/sql/mysql: remove enum sorting (#1021)
* dialect/sql/mysql: remove enum sorting 

Enums are not longer created as sorted values

* Update mysql_test.go
2020-12-07 14:07:13 +02:00
Ariel Mashraki
47c0ade6c7 dialect/sql/schema: replace all unquote for mysql dialect (#1017) 2020-12-05 22:49:01 +02:00
Ariel Mashraki
b70ba95d7b dialect/sql/schema: replace table unquote with schema option (#1016) 2020-12-05 19:43:17 +02:00
Ariel Mashraki
12b7549768 dialect/sql/schema: support mariadb json fields on migration (#1011) 2020-12-03 12:04:00 +02:00
Daven
534dbbe590 dialect/entsql: add support for table-options in annotation (#938) 2020-11-10 20:40:56 +02:00
Ariel Mashraki
762df65f11 dialect/entsql: use annotation in schema builder (#929) 2020-11-08 11:26:44 +02:00
Ariel Mashraki
ae7ba0b43c dialect/sql: minor comment fixes (#687) 2020-08-23 20:48:56 +03:00
Ariel Mashraki
b18716931d dialect/sql: change boolean operators wrapping (#678)
The reason is to parentheses only when it's necessary.
2020-08-20 10:08:31 +03:00
Ariel Mashraki
fd0a7f9f02 all: facebookincubator/ent => facebook/ent (#660)
ent repository is going to be migrated to facebook organization
2020-08-18 11:05:08 +03:00
Ariel Mashraki
3e7481c3a0 dialect/sql/schema: ignore mysql default values for type type (#561) 2020-06-21 23:16:05 +03:00
Ariel Mashraki
cfee55e514 schema/field: add an option to configure the database type (#484) 2020-05-11 15:07:33 +03:00
Alex Snast
68db86be76 avoid multiple rows.Err calls on error path
Signed-off-by: Alex Snast <alexsn@fb.com>
2020-05-11 14:26:40 +03:00
Ciaran Liedeman
f59abad425 fix: checks for error after rows.Next call (#480) 2020-05-09 16:23:47 +03:00
Ariel Mashraki
bcb579106a dialect/sql/schema: revert #463 for int type (#470) 2020-05-07 08:23:10 +03:00
Ariel Mashraki
769a2ed302 dialect/sql/schemma: return the database column type if exists (#463) 2020-05-05 19:32:52 +03:00