Commit Graph

121 Commits

Author SHA1 Message Date
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
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
ed4a8fe010 dialect/sql/schema: replace all unquote for postgres dialect (#1019) 2020-12-06 11:49:02 +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
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
Ariel Mashraki
3d2feec5e2 dialect/sql/schema: initial support for postgres net-types (#964) 2020-11-20 15:30:54 +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
77eaad0df6 dialect/sql/schema: skip default value parsing on pg functions (#951)
Closes #934
2020-11-15 22:55:52 +02:00
ssoor
d5b69da9e0 dialect/sql/schema: add postgres type 'timestamp without time zone' to the scan column (#949) 2020-11-14 19:52:37 +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
dea48a78ea entc/gen: merge list of entsql annotation to one (#928) 2020-11-08 10:57:31 +02:00
Ariel Mashraki
faa54f5e79 Merge branch 'master' of https://github.com/day-dreams/ent into day-dreams-master 2020-10-21 12:31:11 +03: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
kakaxizhang
63421aa9ad dialect/sql/schema: optimize code and add website documents (#748) 2020-10-12 16:08:02 +08:00
Ariel Mashraki
13b379d07c dialect/sql/schema: properly handle indexes of tables with uncountable name (#828) 2020-10-08 23:24:54 +03:00
day-dreams
90c3d50c39 fix: fix comment lint error 2020-09-20 17:02:04 +08:00
day-dreams
1f37dad827 fix: fix comment lint error 2020-09-20 16:56:36 +08:00
day-dreams
4582ed0f2a dialect/sql/schema: use withForeighKeys() instead of withForeighKeysDisable(), and add unit tests () (#748) 2020-09-20 16:49:47 +08:00
Ariel Mashraki
1348df349f dialect/sql/schema: disable fixture in default migration (#753) 2020-09-13 11:13:02 +03:00
day-dreams
54028de04f dialect/sql/schema: add MigrateOption 'WithForeighKeysDisable' (#748) 2020-09-13 01:50:37 +08: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
16d98d1acc dialect/sql/schema: accept default values for enum fields (#646)
Fixed #644
2020-07-28 12:55:02 +03:00
Ariel Mashraki
33e4eb3a52 dialect/sql/schema: change id type of ent_types table to be unsigned (#612) 2020-07-16 20:07:37 +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
3e7481c3a0 dialect/sql/schema: ignore mysql default values for type type (#561) 2020-06-21 23:16:05 +03:00
Ariel Mashraki
55c48a7ef8 dialect/sql/schema: minor style change (#557) 2020-06-17 23:12:03 +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
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
Ariel Mashraki
997a060043 dialect/sql/schemma: fail if column type is invalid (#486) 2020-05-11 14:20:35 +03:00
Ciaran Liedeman
f59abad425 fix: checks for error after rows.Next call (#480) 2020-05-09 16:23:47 +03:00
Ariel Mashraki
7a0b530b89 dialect/sql/schema: fix sqlite indexes matching (#471) 2020-05-07 10:05:17 +03:00
Ariel Mashraki
bcb579106a dialect/sql/schema: revert #463 for int type (#470) 2020-05-07 08:23:10 +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
196a764691 dialect/sql/schema: use the postgres column type if exists (#466) 2020-05-06 21:54:21 +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
8effe6dfeb dialect/sql/schema: remove code-duplication from sqlite test (#425) 2020-04-07 11:03:44 +03:00
Ariel Mashraki
6824259b80 dialect/sql/schema: remove code-duplication from pg test (#422) 2020-04-06 15:44:21 +03:00
Ariel Mashraki
3c03ed00a8 dialect/sql/schema: more code de-duplication from mysql test (#421) 2020-04-06 12:31:54 +03:00
Ariel Mashraki
ff26e5ff7d dialect/sql/schema: remove code-duplication from mysql test (#420) 2020-04-06 12:00:44 +03:00
Ariel Mashraki
b1eb999097 dialect/sql/schema: comment changes (#415) 2020-03-31 22:51:50 +03:00