Commit Graph

75 Commits

Author SHA1 Message Date
Ariel Mashraki
2c63d1d70e all: gofmt -w -r 'interface{} -> any' (#2874) 2022-08-19 18:23:04 +03:00
Ariel Mashraki
2c1a3555cc entc/gen: ignore edge-fields order in edge-schema with composite identifiers (#2719)
This PR allows defining edge schemas with any order of their edges
but still enforce the ordering of the fields in the ID annotation
2022-07-05 15:45:28 +03:00
Ariel Mashraki
311d760679 entc/gen: allow opening and testing concurrent enttest clients (#2665) 2022-06-20 08:32:30 +03: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
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
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
陈杨文
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
Christoph Hartmann
5421d6c628 dialect/sql/schema: handle pg bytea for schema changes (#1462) 2021-04-19 14:46:01 +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
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
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
0d0a93b95f entc/gen: add support for referencing fks to existing fields (#1289) 2021-03-01 22:57:32 +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
Santi Aguilera
75d93200e9 dialect/sql/entsql: allow non incremental primary keys (#1074)
* Allow non incremental PKs

* Format code with gofmt

* Update entc/integration/config/config_test.go

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

* Update entc/integration/config/config_test.go

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

* Update entc/integration/config/config_test.go

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

* Update entc/integration/config/config_test.go

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

* Sort imports

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2020-12-28 17:34:27 +02:00
Nathaniel Peiffer
754e89c6ae entc/gen: add support for indexing id fields (#991)
* fix: allow indexes to be created on ID field

* test: add case for id field

* remove extraneous nil check

* change add primary method

* add integration test for mixin id

* go generate

* add default for default

* make linter happy

* invert if statement

* add default index to card integration test

* add index on default id, mixin id, and composite index

* go generate
2020-12-17 17:58:01 +02:00
Ciaran Liedeman
bbd41dbc87 dialect/sql/schema: integer to string (#954)
* Allow migrations from integer to string with max length

* switched to entsql.Annotation

* removed manual conversion size checks

* fixed unit tests
2020-11-24 18:09:40 +02:00
Ciaran Liedeman
e26d81d9a5 dialect/sql/schema: allow migrations from integer to string without size limit (#952)
* Allow migrations from integer to string without size limit

* Update entc/integration/migrate/entv1/schema/user.go

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

* run generate

* Update entc/integration/migrate/entv2/schema/user.go

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

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2020-11-16 11:44:04 +02:00
Ariel Mashraki
dea48a78ea entc/gen: merge list of entsql annotation to one (#928) 2020-11-08 10:57:31 +02:00
Ariel Mashraki
98aeb19013 entc/internal: add snapshot restore logic (#862)
Issue #852
2020-10-19 14:51:28 +03:00
Ariel Mashraki
2128d0baee dialect/sql/schema: apply size-check only if it is defined in schema (#855) 2020-10-15 14:17:32 +03:00
Ariel Mashraki
13b379d07c dialect/sql/schema: properly handle indexes of tables with uncountable name (#828) 2020-10-08 23:24:54 +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
16d98d1acc dialect/sql/schema: accept default values for enum fields (#646)
Fixed #644
2020-07-28 12:55:02 +03:00
Ariel Mashraki
cedeef653a dialect/sql/schema: accept convert from string2enum and enum2stirng (#587) 2020-07-05 22:22:50 +03:00
Ariel Mashraki
d26fbaeb54 dialect/postgres: fix postgres naming prefix and detection for indexes (#543) 2020-06-10 22:24:16 +03:00
Christoph Hartmann
e03e387988 dialect/sql/schema: handle sql json type for schema OfflineMigration (#542)
Signed-off-by: Christoph Hartmann <chris@lollyrock.com>
2020-06-10 15:41:37 +03:00
Ariel Mashraki
f384701c04 dialect/sql/schemma: ignore pgtime default value on scanning (#468) 2020-05-06 22:34:01 +03:00
Ariel Mashraki
769a2ed302 dialect/sql/schemma: return the database column type if exists (#463) 2020-05-05 19:32:52 +03:00
Ariel Mashraki
51cdda421f dialect/sql/schema: add optional schema-type to column spec (#461) 2020-05-04 20:16:43 +03:00
Ariel Mashraki
2208b243db dialect/sql/schema: initial work for incremental migration (#428)
This is a WIP PR and should be ignored this moment.
It's based on PR #221 created by Erik Hollensbe (He should
get his credit for his work before we land this).
2020-04-12 19:12:33 +03:00
Ariel Mashraki
b1eb999097 dialect/sql/schema: comment changes (#415) 2020-03-31 22:51:50 +03:00
Ariel Mashraki
b4255998bf entc/gen: change name format for edge fks (#286)
* entc/gen: change name format for edge fks

* dialect/sql/schema: add fixture support for mysql and postgres

* sql/dialect: merge fkcolumn queries to one for the 2 dialects
2020-02-03 15:41:55 +02:00
Ariel Mashraki
7fc3689027 dialect/sql/schema: add prepare option to mysql dialect 2020-01-01 19:11:20 +02:00
Ariel Mashraki
58486009c2 dialect/sql/schema: keep the original name of pg index 2019-12-15 16:47:46 +02:00
Ariel Mashraki
25fe5b8f4a dialect/sql/schema: correctly check pg unique constraint 2019-12-15 16:41:28 +02:00
Ariel Mashraki
f98dbbc440 dialect/sql/schema: remove Go 1.13 string features
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/207

Reviewed By: xjtian

Differential Revision: D18743529

fbshipit-source-id: f6420e9ca233e0ce6f9254b4f85d1711ee4d4bfa
2019-11-28 03:16:55 -08:00
Ariel Mashraki
0fc310e600 sql/dialect/schema: ignore foreign-keys in index dropping
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/188

Reviewed By: alexsn

Differential Revision: D18676877

fbshipit-source-id: 0babe457edadfa46dcbc7c7478d4468c48f84361
2019-11-24 05:32:22 -08:00
Ariel Mashraki
ea479ea527 dialect/sql/schema: move SQLite logic to its own file
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/129

Reviewed By: alexsn

Differential Revision: D18164329

fbshipit-source-id: 79abfc76389fcf7fe1b88f2dd6e69600ab7f3af2
2019-10-27 08:59:08 -07:00
Ariel Mashraki
23cbf325c0 dialect/sql/schema: move MySQL logic to its own file
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/128

Reviewed By: alexsn

Differential Revision: D18164283

fbshipit-source-id: da6b4d6df89ae4172d8f47a7790c4dac3a8ffe93
2019-10-27 08:59:08 -07:00
Ariel Mashraki
88bfbc38df dialect/sql/schema: index builders per dialect
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/118

Reviewed By: alexsn

Differential Revision: D18092371

fbshipit-source-id: 02b85724b1e00d10c930112b9e2c8d07c8727216
2019-10-24 02:23:33 -07:00
Ariel Mashraki
a0c7ee77dc dialect/sql/schema: default value format support for postgres
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/116

Reviewed By: alexsn

Differential Revision: D18083400

fbshipit-source-id: 5939aa2d1819d991ae74adc81c4ac60455bb7ed0
2019-10-23 05:39:16 -07:00
Ariel Mashraki
2789257849 dialect/sql/schema: alter table for postgres
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/115

Reviewed By: alexsn

Differential Revision: D18065988

fbshipit-source-id: a7d33bbebd63b01659bc5ba562ac85642dcd3d83
2019-10-22 12:55:36 -07:00
Ariel Mashraki
5f4a55ea1e sql/dialect/schema: load postgres table
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/107

Reviewed By: alexsn

Differential Revision: D18031837

fbshipit-source-id: 863f8db50a0547a7cb5e9ac560066fd6ee4e9c26
2019-10-20 05:20:16 -07:00
Ariel Mashraki
2b6c8eada3 dialect/sql/schema: initial interface for postgres API
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/101

Reviewed By: alexsn

Differential Revision: D17977541

fbshipit-source-id: 118f935e11449661fd91f87b94dde2fb62c9b912
2019-10-17 05:50:49 -07:00