Commit Graph

48 Commits

Author SHA1 Message Date
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
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
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
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
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
3e7481c3a0 dialect/sql/schema: ignore mysql default values for type type (#561) 2020-06-21 23:16:05 +03:00
Ariel Mashraki
cfee55e514 schema/field: add an option to configure the database type (#484) 2020-05-11 15:07:33 +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
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
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
ab71992b7c dialect/sql/mysql: fix verifyrange check for mysql (#337) 2020-02-09 16:09:02 +02:00
qystishere
374b5dd3b8 dialect/sql/schema: support mysql latest numeric type format (#328) 2020-02-08 15:37:35 +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
7fc3689027 dialect/sql/schema: add prepare option to mysql dialect 2020-01-01 19:11:20 +02: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
703a6dd039 dialect/sql/schema: mysql support for uuid type
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/176

Reviewed By: alexsn

Differential Revision: D18615992

fbshipit-source-id: 2c86a661e8d75165470b9b2d351cb973147290d8
2019-11-20 09:49:55 -08:00
Ariel Mashraki
54b1a2ead9 sql/dialect/schema: accept old blob types in mysql (#164)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/164

support varbinary as blob types

Reviewed By: yhayun

Differential Revision: D18504189

fbshipit-source-id: e3c8fcf412d1f6374b0084b439eee426b24b3466
2019-11-14 06:37:17 -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
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
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
1ebfa489c5 ent: add support for enum types
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/45

Reviewed By: alexsn

Differential Revision: D17715085

fbshipit-source-id: 7472e1bd9cf7a8a5bd98f96e6e884c0e27f36803
2019-10-02 12:55:28 -07:00
Ariel Mashraki
57e95e0c7a sql/schema: add MySQL datetime type to column scan
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/39

Reviewed By: alexsn

Differential Revision: D17477388

fbshipit-source-id: 806fdce823ec919115f34b87a29ae411575537c0
2019-09-19 07:58:36 -07:00
Ariel Mashraki
c3955a08f1 schema/field: json type support (#38)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/38

Only `IsNil` and `NotNil` predicates are supported this moment

Reviewed By: alexsn

Differential Revision: D17444976

fbshipit-source-id: 37336fa0bc7749af995933baee2e23bb7366dd78
2019-09-19 05:00:11 -07:00
Ariel Mashraki
d99d9d282e ent/migrate: properly scan text columns
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/34

Reviewed By: alexsn

Differential Revision: D17390040

fbshipit-source-id: 92cb0e638f484877af185a88e41aa9c5eef6d22b
2019-09-15 08:08:41 -07:00
Ariel Mashraki
7dfe3c174c sql/schema: more precise blob definition
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/29

Reviewed By: alexsn

Differential Revision: D17284406

fbshipit-source-id: 84c2ffb50b8f016ad361f1420c5352c7969cbc77
2019-09-10 12:40:37 -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
4c1f28d58f ent/schema: allow setting collation for string fields
Reviewed By: a8m

Differential Revision: D17090481

fbshipit-source-id: a08768c9bac4318a91bc6a067c85d6eb022c3024
2019-08-28 04:52:32 -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
Ariel Mashraki
108affa8dd ent/schema: move schema packages into a separate package
Reviewed By: alexsn

Differential Revision: D16763332

fbshipit-source-id: e3e4279c62992de192464c3d3b1036c45687507c
2019-08-12 07:53:03 -07:00
Ariel Mashraki
2128fc2ca1 ent/index: add indexes api
Reviewed By: alexsn

Differential Revision: D16757699

fbshipit-source-id: 6a0027b1f855721f1415b8c72b5b1be8bc2ce902
2019-08-12 06:44:40 -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
4b176495e8 add support for all int types in schema
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/8

Reviewed By: alexsn

Differential Revision: D16131257

fbshipit-source-id: 7b362740053c684f70ec69188b2fcee898605436
2019-07-10 09:24:31 -07:00
Ariel Mashraki
e8e96f014f add charset support for fields
Summary: Basically, adding support for Hebrew characters.

Reviewed By: alexsn

Differential Revision: D16068537

fbshipit-source-id: 4e934da5ea97c9e804317f746556ab1d51faebcc
2019-07-01 08:10:24 -07:00
Ariel Mashraki
0e605681b2 quote table name on DESCRIBE statement (#7)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/7

avoid conflicting with reserved words (e.g. "groups" became reserved word in MySQL 8.x)

Reviewed By: alexsn

Differential Revision: D15957279

fbshipit-source-id: b6944752c7e5f6ec37119b11cc0ab8a0d7d3a7ff
2019-06-23 01:51:28 -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
Ariel Mashraki
5f0268e02c add tests for mysql migration
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/4

Reviewed By: alexsn

Differential Revision: D15874726

fbshipit-source-id: 217fbc0503e961704ea646ee40663a30211c5af1
2019-06-18 10:11:00 -07:00