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
Ariel Mashraki
deb63d0292
dialect/sql: support passing selectors to basic predicates
...
Closed https://github.com/ent/ent/issues/2236
2021-12-25 15:02:49 +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
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
Ariel Mashraki
1c263c7abd
dialect/sql: add support for SelectExpr ( #2220 )
2021-12-16 13:50:03 +02:00
Yoni Davidson
b8149f2768
dialect/schema: support float for mysql on inspection ( #2191 )
...
* dialect/schema: support float for mysql
* add tests
2021-12-07 12:45:46 +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
Naor Matania
8847a1ac55
dialect/sql/schema: fix migrating Postgres fields with max character varchar custom type ( #2162 )
...
* Support migration of varying length varchar postgres
* update type
* fix type
* improve type
* remove not needed change
* fix failing test
* add inspect test
* add more tests
* go fmt
* fix pr comment
2021-11-28 07:57:57 +02:00
Ariel Mashraki
b99ce66f40
dialect/sql: calling Update.Add after Update.Set should append expression ( #2168 )
2021-11-25 12:03:12 +02:00
Ariel Mashraki
6402fc7fe2
Merge pull request #2137 from ent/getoutreach-grevych/sqljson-pattern-matching-predicates
...
Getoutreach grevych/sqljson pattern matching predicates
2021-11-16 10:21:08 +02:00
Ariel Mashraki
77701d4db6
dialect/sql/sqljson: use the builtin string predciates in sqljson and improve tests
2021-11-16 10:07:34 +02:00
Ariel Mashraki
a5fea077a9
dialect/sql: use identifier qualifiers for WHERE clause on upsert
...
Fixed https://github.com/ent/ent/issues/2126
2021-11-12 23:46:46 +02:00
Ariel Mashraki
0dd7b0d7c3
dialect/sql/sqljson: fix sqlite haskey and add docs
2021-11-11 18:58:28 +02:00
Ariel Mashraki
3ba2b4e173
entc/integration/json: add tests for null literals
2021-11-10 17:24:51 +02:00
Ariel Mashraki
0c5398a11d
dialect/sql/sqljson: support comparing values with null literal
2021-11-10 17:24:51 +02:00
Ariel Mashraki
dd6c034c2a
dialect/sql/schema: support mediumtext field in migration
...
Fixed https://github.com/ent/ent/issues/2113
2021-11-07 15:37:06 +02:00
Ariel Mashraki
8f88f58713
dialect/sql/sqlgraph: minor refactor changes
2021-11-07 14:01:54 +02:00
Ariel Mashraki
e8e4401d27
dialect/sqltest: use postgres dialect in predicate tests
2021-11-03 13:39:39 +02:00
Ariel Mashraki
02203c3f91
dialect/sqltest: ensure predicates can be reused
2021-11-02 23:01:11 +02:00
Alexander Melentyev
147b1f59ae
all: small typo fixes ( #2095 )
2021-11-01 17:47:06 +02:00
Andrey Elenskiy
62d64f2b78
dialect/sql/sqlgraph: use selector's column instead of table's column in HasNeighbors ( #2060 )
...
Allows for HasNeighbors' selector to be a generic selector instead of *SelectTable.
A use case for this is doing HasNeighbors* function on materialized queries instead
of on concrete tables only.
2021-10-25 07:46:54 +03:00
Ariel Mashraki
a1f6de2793
dialect/sql: escape special characters in pattern matching
...
Resources:
- https://www.postgresql.org/docs/current/functions-matching.html\#FUNCTIONS-LIKE
- https://www.sqlite.org/lang_expr.html\#the_like_glob_regexp_and_match_operators
- https://dev.mysql.com/doc/refman/8.0/en/string-literals.html
Fixed https://github.com/ent/ent/issues/2059
2021-10-24 21:14:26 +03:00
Ariel Mashraki
963bd669fd
dialect/sql: add example to SIMILAR TO predicate ( #2055 )
2021-10-21 12:01:58 +03:00
Ariel Mashraki
3e6c40886d
entc/gen: support count with field selection
...
Fixed https://github.com/ent/ent/issues/2036
2021-10-17 19:03:49 +03:00
Ariel Mashraki
899e9f0e50
dialect/sql: wraps the sql.Rows with ColumnScanner interface
2021-10-14 09:32:30 +03:00
Ariel Mashraki
9e809635b2
entc/gen: ignore immutable fields on Upsert<T>.UpdateNewValues
...
Also, for some reason, the TimeMixin.UpdateTime was an immutable field,
but this was incorrent, because the codegen just skip generating
update setters to it. Removing the Immutable modifier allows users
to set this field explicitly.
2021-10-08 08:20:05 +03:00
Ariel Mashraki
f30a17edd4
all: fix linting issues before migrating to golangci v1.42 ( #2019 )
2021-10-07 19:54:43 +03:00
Shen Yang
65cf307b10
dialect/sql/schema: add support for tstzrange and interval and in postgres ( #2013 )
...
Fixes #1989
2021-10-06 21:46:34 +03: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
4306643d16
dialect/sql/sqlgraph: support sql.Scanner types when scanning IDs ( #1987 )
...
Fixed https://github.com/ent/ent/issues/1985
2021-09-27 17:49:57 +03:00
Ariel Mashraki
4c2faf2282
entc/gen: allow spaces in enum fields
2021-09-23 23:23:28 +03:00
storyicon
779594f7da
dialect/sql/schema: support mysql mediumtext type ( #1972 )
...
Signed-off-by: storyicon <yuanchao@bilibili.com >
2021-09-22 15:35:14 +03:00
Ariel Mashraki
5c7c36bf29
dialect/sql/schema: skip parsing expression default for postgres
...
Fixed https://github.com/ent/ent/issues/1962
2021-09-21 15:59:04 +03:00
Ariel Mashraki
5f31091dcd
entc/gen: support de/incrementing values on upsert
...
Fixed https://github.com/ent/ent/issues/1952 .
2021-09-17 14:25:34 +03:00
Ariel Mashraki
912415e1e1
dialect/sql: add Add method to UpdateSet
2021-09-16 23:41:29 +03:00
Ariel Mashraki
3c650e507e
dialect/sql: use raw 0 in COALESCE function on Add calls
...
The second argument for COALESCE function is not a dynamic argument (always 0).
2021-09-16 23:07:45 +03:00
Ariel Mashraki
38925b6134
dialect/sql/schema: revert #1547 for mariadb
2021-09-14 13:07:49 +03:00
Ariel Mashraki
0864659844
dialect/sql/sqlgraph: avoid creating tx blocks for single UPDATE statements
...
In PostgreSQL, every statement is executed within a transaction. Therefore, we can avoid
creating transaction blocks manually (group of statements surrounded by BEGIN and COMMIT)
for UpdateNodes operation with a single UPDATE statement.
Benchmark for 2000 operations was improved from:
7.98s 3992160 ns/op 4887 B/op 116 allocs/op
To:
4.42s 2209659 ns/op 4435 B/op 104 allocs/op
---
MySQL and SQLite share the same behavior. Please see #1858 for more info.
2021-09-11 08:56:37 +03:00
Emmanuel T Odeke
9904bcb8c8
all: add (*testing.B).ReportAllocs() to all benchmarks ( #1919 )
...
This allows a full picture when continuous benchmarking
is added to this repository and when any changes are made
to the code in here.
Fixes #1918
2021-09-07 17:04:07 +03:00
Ariel Mashraki
b23a0e8554
dialect/sql/sqlgraph: avoid creating tx blocks for single DELETE statements
...
In PostgreSQL, every statement is executed within a transaction. Therefore, we can avoid
creating transaction blocks manually (group of statements surrounded by BEGIN and COMMIT)
for DeleteNodes operation as it's implemented with a single statement.
Benchmark for 4000 operations was improved from:
14.54s 7270455 ns/op 3702 B/op 81 allocs/op
To:
5.36s 2679935 ns/op 2864 B/op 59 allocs/op
---
MySQL and SQLite share the same behavior. Please see https://github.com/ent/ent/pull/1858
for more info.
2021-08-27 16:02:29 +03:00
dakimura
dac5ccaec9
dialect/sql/schema: fix error message for the missing fk constraints ( #1861 )
2021-08-22 22:05:40 +03:00
Ariel Mashraki
ea67be12a4
dialect/sql/sqlgraph: avoid creating tx blocks for single statement create operation
...
For example, in PostgreSQL, every statement is executed within a transaction. Therefore, we can avoid creating transaction
blocks manually (group of statements surrounded by BEGIN and COMMIT) for CreateNode operation with single SQL statement.
Benchmark was improved from:
(2000 Inserts) 8.41s 4206748 ns/op 4595 B/op 115 allocs/op
To:
(2000 Inserts) 4.66s 2330222 ns/op 4107 B/op 104 allocs/op
2021-08-20 21:12:24 +03:00
Rotem Tamir
f326c7dfd0
dialect/sql: report explicit error when trying to SELECT .. FOR UPDAT… ( #1847 )
...
* dialect/sql: report explicit error when trying to SELECT .. FOR UPDATE with sqlite
* remove redundant assertion
2021-08-17 12:54:23 +03:00
Ariel Mashraki
b8532f87a6
entc/gen: support for upsert with client generated ids
...
Fixed #1826
2021-08-14 17:44:04 +03:00
Ariel Mashraki
e71ccc6b6e
dialect/sql/sqlgraph: fix bug in entql predicate evaluation ( #1827 )
2021-08-11 21:03:52 +03:00
Ariel Mashraki
397b3e984d
dialect/sql/schema: setup tables before execute hooks
2021-08-04 21:43:00 +03:00
Ariel Mashraki
09c4306378
entc/gen: add support for upsert/on-conflict feature-flag
2021-08-04 14:01:31 +03:00
Gerardo Reyes
f9e2609e95
dialect/sql: add pattern matching predicates for json values
2021-08-02 17:33:13 +02:00
Ariel Mashraki
16c4b3379b
sqlgraph: change modifiers to onconflict options
2021-08-01 18:43:59 +03:00
Ariel Mashraki
b19ac669c7
dialect/sql: override column values on Updater.Set
...
Avoid cases like 'SET a = 1, a = 2'.
2021-08-01 09:53:26 +03:00