Commit Graph

91 Commits

Author SHA1 Message Date
Ariel Mashraki
397ebe9f39 dialect/sql/schema: allow running migration concurrently without copying the tables (#4475) 2025-12-11 22:32:32 +02:00
Jannik Clausen
51e185459a dialect/sql/schema: add option to control symbol hashing logic for schema dump (#4411) 2025-07-10 09:32:25 +02:00
Jannik Clausen
eec2a183c0 dialect/sql/schema: resource positions: remove unnecessary function a… (#4391)
* dialect/sql/schema: resource positions: remove unnecessary function argument

* fix linter
2025-05-21 15:19:30 +02:00
Jannik Clausen
c12502dba5 dialect: support atlas external schema resource positions (#4390) 2025-05-20 14:12:53 +02:00
Giau. Tran Minh
b1786895ce dialect/sql: remove all DDL builders that no longer used (#4369) 2025-04-08 19:44:03 +07:00
Jannik Clausen
fed373ab2f dialect/sql/schema: support dialect specific view definitions (#4340) 2025-02-24 13:43:19 +01:00
MengYX
428604afd7 fix: ent schema panics if any field contains the DefaultExprs annotation (#4338)
fixes https://github.com/ent/ent/issues/4337
2025-02-24 08:19:12 +01:00
Jannik Clausen
8b85c83e00 dialect/sql/schema: add multi schema and view support for schema dump (#4335) 2025-02-21 15:16:17 +01:00
Jannik Clausen
05c977357f dialect/sql/schema: add schema dump command (#4296)
* dialect/sql/schema: add schema dump command

* entc/gen/template: drop build flag from generated globalid.go
2025-01-15 16:24:02 +01:00
Jannik Clausen
01e21a2c30 dialect/sql/schema: remove deprecated legacy migration engine (#4294) 2025-01-14 12:57:51 +01:00
Ariel Mashraki
15bebe8d89 ent: support schema view (#4157) 2024-07-28 19:00:47 +03:00
Ariel Mashraki
9aba4ae091 entc/gen: initial work for multi-schema migration using atlasgo.io (#3821) 2023-11-13 12:35:31 +02:00
Ariel Mashraki
50938a51c6 dialect/sql/schema: add table schema (#3818) 2023-11-11 23:28:22 +02:00
Ariel Mashraki
3b7715b552 dialect/sql/schema: allow setting table comments (#3365) 2023-03-04 20:50:26 +02:00
Ariel Mashraki
136807549d dialect/entsql: supports setting SQL column comments (#3191)
* feat: Add column comment in SQL DDL, using EntSQL annotations to achieve it.

* Update annotation.go

* fix lint

* Add table primary key column comment

* entsql.Comment(string)  is unnecessary

* entc/gen: minor changes to entsql.WithComments + add tests

Co-authored-by: chenghonour <wantto@outlook.com>
2022-12-26 14:48:37 +02:00
Ariel Mashraki
1e5f68646f dialect/sql/entsql: support setting expression as column default value
Fixed https://github.com/ent/ent/issues/3069
2022-11-12 14:38:33 +02:00
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