Commit Graph

589 Commits

Author SHA1 Message Date
Jannik Clausen
d5c8b282de dialect/sql/schema: inspect outside transaction in auto migrate (#4290)
Since SQLite does not allow enabling/disabling foreign key checks within a transaction, Atlas disabled foreign key checks before opening a transaction and re-enables them after commit/rollback. This involves checking for violations every time the auto migrate tool checks for changing. By opening a transaction only in case there are changes, we can avoid this when not needed.

Closes https://github.com/ariga/atlas/issues/3297
2025-01-09 08:32:47 +01:00
Ronen Lubin
89ad7fa39d dialect/sql: fix error formatting (#4244)
* dialect/sql: fix error formating

* use errors.join
2024-10-21 14:56:53 +03:00
Mohsin Hijazee
d1dab301c6 dialect/sql: add HasPrefixFold and HasSuffixFold predicates (#4233)
* FieldHasPrefixFold and HasPrefixFold predicates

* FieldHasSuffixFold and HasSuffixFold predicates

* Review feedback - per dialect SQL generation.
2024-10-09 16:32:48 +03:00
Ariel Mashraki
9627017062 dialect/sql: support scanning extra nullable time columns (#4232) 2024-10-05 11:03:53 +03:00
Tran Minh Luan
057c0ee063 go: update go to latest (#4188)
* go: update go to latest

* chore: fix lint
2024-08-23 11:46:59 +03:00
Ariel Mashraki
15bebe8d89 ent: support schema view (#4157) 2024-07-28 19:00:47 +03:00
Ariel Mashraki
5cd2ede22d dialect/entsql: add Skip annotation (#4156) 2024-07-26 23:03:21 +03:00
Ariel Mashraki
9f61938bcc doc: explain how to use policies in migrations (#4141) 2024-07-14 14:53:22 +03:00
Ariel Mashraki
7064e58744 dialect/sql/sqlgraph: replace IN with EXISTS in HasNeighbors/With predicates (#4060) 2024-05-19 12:31:07 +03:00
sunxunle
c25a28565e entc/gen: fix doc typos (#3979)
Signed-off-by: sunxunle <sunxunle@gmail.com>
2024-03-18 08:33:08 +02:00
Eric Lindvall
91df8e59c2 dialect/sql/schema: Atlas cleanSchema should handle non-existent tables (#3931)
sqlite fts5 virtual tables create additional tables that are automatically
deleted when the virtual table is deleted.

This will cause "no such table" errors when trying to drop them when creating
a new migration.
2024-02-04 12:46:33 +07:00
JSH
1bcb2fa9cc dialect/sql/sqlgraph: allow scanning non-numeric IDs in batch creations (#3830)
* Use same logic between lastInsertId & lastInsertIds

* fix for bulkcreator.insertLastIds
2024-01-03 23:34:23 +02:00
Michael Caulley
ffe0aa8ac7 fix: swap the order of handling order and pred in the graph select func (#3841)
multi order may generate predicates, so running the order funcs first allows reusing aliases
2023-11-23 19:01:24 +02:00
Michael Boke
717ac7832a dialect/sql: added support for mariadb uuid native type (#3131) 2023-11-21 00:58:11 +07:00
Ariel Mashraki
9aba4ae091 entc/gen: initial work for multi-schema migration using atlasgo.io (#3821) 2023-11-13 12:35:31 +02:00
Ariel Mashraki
50938a51c6 dialect/sql/schema: add table schema (#3818) 2023-11-11 23:28:22 +02:00
Ariel Mashraki
c2ff3ff3bc dialect/entsql: add schema to package annotation (#3817) 2023-11-10 10:57:26 +02:00
Ariel Mashraki
37f57d9a97 dialect/entsql: add helper function for creating table annotation (#3816) 2023-11-10 10:44:14 +02:00
Luc van Kessel
d8774635e6 dialect/sql/sqlgraph: support nil errors in constraint checks (#3701)
* added nil checks to constraint errors

* removed whitespace from nil error checks

---------

Co-authored-by: Luc van Kessel <luc@klippa.com>
2023-08-18 22:13:38 +03:00
Ariel Mashraki
91c7fcc685 dialect/sql/schema: allow only table creation modification in automatic schema planning (#3660) 2023-07-26 11:24:33 +03:00
Ariel Mashraki
f0a81e2640 dialect/sql: add predicate to check hasprefix between columns/fields 2023-06-22 15:43:25 +03:00
Ariel Mashraki
0055559b1b dialect/sql: add tests to new logical predicate functions 2023-06-22 00:08:26 +03:00
Ariel Mashraki
808edd134d dialect/sql: support capturing predicates in selectors
This allows custom predicates mutating the root querying and still respect the AND/OR/NOT semantics
2023-06-22 00:08:26 +03:00
Ariel Mashraki
b49d5f5924 dialect/sql/sqlgraph: expose standard modifier to eager-load N neighbors (#3603) 2023-06-17 12:23:57 +03:00
Ariel Mashraki
a8851db571 dialect/sql/sqljson: inline boolean values (#3570)
Some drivers like mysql encodes them as 0/1
2023-05-29 17:15:32 +03:00
Ariel Mashraki
2924da5175 dialect/sql: expose the underyling builder of UpdateSet (#3541) 2023-05-16 00:00:56 +03:00
Ariel Mashraki
fc8d095da8 dialect/sql: add OrderByRand option (#3518) 2023-05-04 12:13:24 +03:00
Ariel Mashraki
f251400818 dialect/sql/schema: support passing schema diff options (#3516) 2023-05-03 11:28:10 +03:00
Ariel Mashraki
a792f429a6 dialect/sql/schema: allow ariga.io/atlas schema diff to be extended (#3514)
By not relying on the SchemaDiff signature, we allow the schema.Differ to be extended without introducing breaking changes to ent
2023-05-01 17:14:17 +03:00
Ariel Mashraki
bc7d8c936f dialect/sql/sqlgraph: replace id IN with EXISTS for HasNeighbors predicates (#3492) 2023-04-19 17:52:01 +03:00
Ariel Mashraki
8cb27bc7cf dialect/sql: add method for finding selection occurrences in queries (#3473) 2023-04-12 23:22:52 +03:00
Ariel Mashraki
44b8648720 dialect/sql/sqlgraph: allow query edge fields with alias (#3470) 2023-04-11 13:55:04 +03:00
Ariel Mashraki
36cd6a8a8b dialect/sql: skip formatting qualified columns (#3469) 2023-04-11 13:16:40 +03:00
Giau. Tran Minh
baaa22d018 entsql: added OnDelete annotation (#3459)
Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
2023-04-09 23:36:35 +07:00
Ariel Mashraki
5b1de3901a doc: update ordering fluent api (#3456) 2023-04-09 15:00:16 +03:00
Ariel Mashraki
064c9118b7 entc/gen: add fluent-api for order options (#3449) 2023-04-09 10:37:42 +03:00
Ariel Mashraki
02bb3269af dialect/sql: move order-by options to top-level driver package (#3446) 2023-04-07 00:35:20 +03:00
Ariel Mashraki
0e7203655e dialect/sql/sqlgraph: allow selecting order by terms (#3439) 2023-04-04 14:00:35 +03:00
Ariel Mashraki
4c332f7bba doc/features: add dynamic values support (#3436) 2023-04-03 17:55:28 +03:00
Ariel Mashraki
ba7f158a9c entc/gen: allow scanning dynamic sql values (#3432) 2023-04-03 17:07:24 +03:00
Ariel Mashraki
abafd91b2d dialect/sql: move columns check from codegen to sql package (#3431) 2023-04-02 13:57:21 +03:00
Ariel Mashraki
90289b7494 dialect/sql: additional predicate helpers (#3429) 2023-04-02 13:01:36 +03:00
Ariel Mashraki
27bc0470eb dialect/sql/sqlgraph: add Step helpers for edge types (#3428) 2023-04-01 21:34:42 +03:00
Ariel Mashraki
60bb939fc2 dialect/sql/sqlgraph: add function to order by edge terms (#3426) 2023-04-01 20:55:00 +03:00
Zhizhen He
6f847a3492 ci: add spell checker and fix existing typo (#3420)
* ci: add spell checker and fix existing typo

* chore: move typos.toml to .github

* fix: correct config file path
2023-03-30 11:38:29 +03:00
Ariel Mashraki
e3cee0adc2 dialect/sql/sqlgraph: add function to order by edge count (#3422) 2023-03-30 10:10:59 +03:00
Ariel Mashraki
651a2a166e dialect/sql: add Joined<T> helpers for Selector to avoid double joining (#3419) 2023-03-28 15:33:21 +03:00
Ariel Mashraki
427aaf7d45 dialect/sql: add Selector.HasJoins helper (#3418) 2023-03-28 14:31:43 +03:00
Ariel Mashraki
d9e7adfa05 dialect/sql/sqlgraph: catch SQLite INSERT errors executed with Driver.Query (#3415) 2023-03-27 22:21:47 +03:00
Ariel Mashraki
c35f786f86 entc/gen: ensure edge-fields are selected when their edges are loaded (#3401) 2023-03-20 19:11:04 +02:00