MasseElch
0239daca7b
dialect/sql/schema: versioned migrations ( #2337 )
...
* dialect/sql/schema: fix go doc
* all: update atlas
* dialect/sql/schema: diff connected DB and defined schema and write changes to migration file
* dialect/sql/schema: use migration directory and formatter directly instead of a planner
* all: update atlas
* cmd: add command to create a new migration file
* entc/gen: generate main.go with migrate diff example
* all: regenerate
* cmd/internal/base: make linter happy
* all: support Go 1.16 in versioned migrations main.go
* entc/gen: put versioned migrations behind feature flag
* all: regenerate
* cmd/ent: driver-prefixed dsn in migrate diff command
* cmd/internal/base: remove prefix from migrate import
* cmd/internal/base: use cobra.CheckErr
* cmd: remove diff command
* entc/gen/template/dialect/sql/feature: remove generated main.go
* all: rebase on master and go mod tidy
* all: regenerate
2022-02-21 12:15:17 +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
Mehmet Yılmaz
4d01a56b8d
dialect/sql/schema: allow adding DEFAULT to columns on migration #1758 ( #2199 )
...
* add feature to SET DEFAULT value when add new default value to a existing column
* refactoring unit tests
* correct misspells
* code review refactors
* refactors
* Update dialect/sql/schema/postgres.go
* Update dialect/sql/schema/postgres.go
* Update dialect/sql/schema/postgres.go
* Update dialect/sql/schema/postgres.go
* Update dialect/sql/schema/postgres.go
Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com >
2021-12-20 11:29:07 +02:00
Ariel Mashraki
14cba0abb6
dialect/sql/schema: make Field.Unique and Index.Unique equal ( #2004 )
...
This will allow moving from:
field.String(c).Unique()
To:
index.Field(c).Unique()
And vice versa
2021-10-03 16:20:28 +03:00
Ariel Mashraki
397b3e984d
dialect/sql/schema: setup tables before execute hooks
2021-08-04 21:43:00 +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
66871c9806
dialect/sql/schema: add support for index prefixes in mysql
2021-06-09 22:52:31 +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
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
dd4792f5b3
go: rename module from github.com/facebook/ent => entgo.io/ent ( #1226 )
2021-02-02 23:03:04 +02:00
Ariel Mashraki
cc8da8fbf7
dialect/sql/schema: schema match from predicate
2021-01-18 12:38:39 +02:00
Ariel Mashraki
cfb8f5c4a9
dialect/sql/schema: minor style changes ( #1152 )
2021-01-07 20:37:47 +02:00
Ruben de Vries
a9c39bb952
dialect/sql/schema: add migration hooks ( #1150 )
2021-01-07 20:23:01 +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
kakaxizhang
63421aa9ad
dialect/sql/schema: optimize code and add website documents ( #748 )
2020-10-12 16:08:02 +08: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
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
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
55c48a7ef8
dialect/sql/schema: minor style change ( #557 )
2020-06-17 23:12:03 +03:00
Ariel Mashraki
997a060043
dialect/sql/schemma: fail if column type is invalid ( #486 )
2020-05-11 14:20:35 +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
320b9caf61
dialect/sql/schema: add option to skip fixture when it's irrelevant ( #350 )
2020-02-16 18:17:58 +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
c0c0d2ae5c
dialect/sql/schema: verify and fix mysql auto-increment on reset ( #329 )
2020-02-06 19:36:23 +02: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
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
7fc3689027
dialect/sql/schema: add prepare option to mysql dialect
2020-01-01 19:11:20 +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
a5e4a9cf54
dialect/sqlscan: add ScanInt64 to be used by sqlgraph
...
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/213
Reviewed By: alexsn
Differential Revision: D18763694
fbshipit-source-id: 890b35fcc2a28914b276ce65477788b4ddaeebf9
2019-12-03 01:44:48 -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
d5c111b35a
dialect/sql/schema: univerdal id support for postgres
...
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/122
Reviewed By: alexsn
Differential Revision: D18113754
fbshipit-source-id: 1050f0c2b823db6ba1bc37c36f6749cfcffa982d
2019-10-24 08:45:09 -07:00
Ariel Mashraki
7f598f34a2
dialect/sql/schema: fix constraint symbol size for postgres
...
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/121
Reviewed By: alexsn
Differential Revision: D18113304
fbshipit-source-id: 80d4c65323eb2613fbb9ab47754b1e70b42b1b15
2019-10-24 08:45:09 -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
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
dff3067639
dialect/sql/schema: table creation tests for postgres
...
Reviewed By: alexsn
Differential Revision: D18059272
fbshipit-source-id: f93785378119dfa18be31fdfc969848ea6d9b782
2019-10-22 08:17:05 -07:00
Ariel Mashraki
6f5f42ab3c
dialect/sql: dialect based builders ( #1550 )
...
Summary:
Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1550
Pull Request resolved: https://github.com/facebookincubator/ent/pull/84
This is still WIP and you should ignore this.
Reviewed By: alexsn
Differential Revision: D17854477
fbshipit-source-id: 2d19713c118adb31164b7a2781327e64c87db8d4
2019-10-13 07:03:11 -07:00
Ariel Mashraki
6915b13d25
ent/gen: add support for external tempaltes execution
...
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/30
Reviewed By: dlvhdr
Differential Revision: D17318127
fbshipit-source-id: eccc2963f648296e222de9d002ab3caa8fac1389
2019-09-11 12:18:34 -07:00
Alex Snast
b71ee6820b
ent/schema: remove string field charset / collation settings
...
Summary: don't expose starage specific features in ent schema
Reviewed By: a8m
Differential Revision: D17111724
fbshipit-source-id: fca9e624b272c0db3fed14c511fa6cb07816a100
2019-08-29 07:38:39 -07:00
Alex Snast
011e6d24ae
ent/migrate: correctly handle column collation change
...
Summary: In addition coulmn description on create / alter table to use 'CHARACTER SET' keyword instead of 'CHARSET' per mysql docs (https://dev.mysql.com/doc/refman/5.7/en/charset-column.html )
Reviewed By: a8m
Differential Revision: D17090725
fbshipit-source-id: d0f53a547ff8d68f2b2b54af96ef5b86f60f74b4
2019-08-28 02:18:02 -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
c16d3c8e25
ent/schema: explicitly defines non-null fields in schema
...
Reviewed By: alexsn
Differential Revision: D16791620
fbshipit-source-id: bad3ac7b2349d2f483c804eb3623c6dfa8b06313
2019-08-15 03:37:17 -07:00