Commit Graph

43 Commits

Author SHA1 Message Date
Jannik Clausen
01e21a2c30 dialect/sql/schema: remove deprecated legacy migration engine (#4294) 2025-01-14 12:57:51 +01:00
Ariel Mashraki
891fc8fecf dialect/sql/schema: support setting default value expressions on id fields (#3089) 2022-11-13 18:55:04 +02:00
Ariel Mashraki
3b5a535801 dialect/sql/schema: allow setting JSON default values on pg, sqlite and maria (#3081) 2022-11-11 07:41:21 +02:00
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
3fc4ba6f15 dialect/entsql: add support for partial indexes (#2944) 2022-09-20 15:07:28 +03: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
Ariel Mashraki
317594ec80 dialect/sql/schema: prefix sqlite unique indexes with table name (#2433)
Fixed https://github.com/ent/ent/issues/2421
2022-03-28 12:54:39 +03:00
Ariel Mashraki
60e03285d0 dialect/sql/schema: hello ariga.io/atlas (#2279) 2022-01-20 17:20:50 +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
dakimura
dac5ccaec9 dialect/sql/schema: fix error message for the missing fk constraints (#1861) 2021-08-22 22:05:40 +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
42a2c67cc4 dialect/entsql: add support for table checks in schema/migration 2021-06-17 23:22:37 +03:00
Ariel Mashraki
fd1f2df150 dialect/sql/schema: add support for pg arrays in migration 2021-04-14 14:25:28 +03: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
dd4792f5b3 go: rename module from github.com/facebook/ent => entgo.io/ent (#1226) 2021-02-02 23:03:04 +02:00
Ariel Mashraki
3930d3c835 schema/field: implement field.Other (#1218)
* Implement Other Field

* Implement Other Field

* Changed dialect types

* run generate

* doc typo

* docs added

* schema/field: additional validation and tests for Other type

Co-authored-by: Ciaran Liedeman <ciaran@stackworx.io>
2021-01-31 17:43:28 +02:00
Ariel Mashraki
8b798d2714 dialect/sql/schema: add tables inspection capabilities (#1178) 2021-01-17 16:41:07 +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
kakaxizhang
63421aa9ad dialect/sql/schema: optimize code and add website documents (#748) 2020-10-12 16:08:02 +08: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
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
7a0b530b89 dialect/sql/schema: fix sqlite indexes matching (#471) 2020-05-07 10:05:17 +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
a6e5124d13 dialect/sql/schema: better error message for sqlite limitation (#401) 2020-03-22 22:04:00 +02:00
Ariel Mashraki
26440c2bc9 dialect/sql/schema: setrange on custom column name of pks (#333) 2020-02-09 09:41:26 +02:00
Ariel Mashraki
6819c01906 dialect/sql: allow nil values for exec commands (#313)
In most cases, the sql.Result is not needed.
2020-01-22 22:43:45 +02:00
Ariel Mashraki
6bb834612c dialect/sql/schema: drop unique constraint on pg migration
Fixes #235
2019-12-15 18:52:05 +02:00
Ariel Mashraki
e54373f410 ent: allow non-numeric columns as PKs
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/180

Reviewed By: alexsn

Differential Revision: D18636443

fbshipit-source-id: f14b34926817f6d9652f49a640bfb377f3f3cdaf
2019-11-21 08:49:58 -08:00
Ariel Mashraki
f7dac21972 dialect/sql/schema: sqlite support for uuid type
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/177

Reviewed By: alexsn

Differential Revision: D18615595

fbshipit-source-id: b3167a0aa9260cdf22d88dd7e45c7ebfae1909d5
2019-11-20 09:49:55 -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
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
c414cd9a82 dialect/sql/schema: alter column for postgres
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/117

Reviewed By: alexsn

Differential Revision: D18083914

fbshipit-source-id: a5f6993cfe9a260a84c0d4ab868e3e797b3a5776
2019-10-23 05:39:17 -07:00
Ariel Mashraki
bd07c86b60 all: add license header to all go files
Summary:
Used addlicense to generate this:
 addlicense -c "Facebook Inc" -f license_header .

example was taken from: https://github.com/facebook/litho/blob/master/lib/soloader/BUCK

Reviewed By: alexsn

Differential Revision: D17070152

fbshipit-source-id: e7b91398d7f6181727be3400c1872ad5f28e38ed
2019-08-27 04:48:28 -07:00
Ariel Mashraki
e0e754717e ent: change ent package name (#1338)
Summary:
Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1338

Pull Request resolved: https://github.com/facebookincubator/ent/pull/14

Reviewed By: alexsn

Differential Revision: D16890825

fbshipit-source-id: 656baaa73f5debab08c849b6b9639caeec2a8ef1
2019-08-19 09:32:14 -07:00
Ariel Mashraki
329b5ddf77 ent/sql/migrate: support indexes
Reviewed By: alexsn

Differential Revision: D16711184

fbshipit-source-id: 632b02c5c77c6289b242263647d45d9f28752e3f
2019-08-11 05:47:18 -07:00
Ariel Mashraki
b5cdb810b8 dialect/sql/schema: universl id allocation support
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/9

Reviewed By: alexsn

Differential Revision: D16252229

fbshipit-source-id: 795b6556d322e5c1ff5fb826c3b06ba5421ac857
2019-07-15 02:30:41 -07:00
Ariel Mashraki
970a410b31 add tests for sqlite migration
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/5

Reviewed By: alexsn

Differential Revision: D15875669

fbshipit-source-id: 5ddebe396b9683f364e91f2f9e6296e3659ff618
2019-06-18 10:55:48 -07:00
facebook-github-bot
267e3c15bd Initial commit
fbshipit-source-id: c79a38536e3c128dce1b2948615b72ec9779ed22
2019-06-16 04:37:51 -07:00