Commit Graph

570 Commits

Author SHA1 Message Date
iazpiazu
d056659140 dialect/sql/sqlgraph: set schema when clearing foreign key edges (#4429)
* set schema in clearfkedges func

* add test case for clearing bidirectional o2o foreign key
2026-02-14 08:11:01 +02:00
Ariel Mashraki
397ebe9f39 dialect/sql/schema: allow running migration concurrently without copying the tables (#4475) 2025-12-11 22:32:32 +02:00
Ariel Mashraki
175d96f7ec dialect/sql/schema: pass unit to atlas constructor (#4420) 2025-07-31 11:10:01 +03:00
Tantatorn Suksangwarn
9442826ba6 doc: update FieldEqualFold comment for clarity on case-folding equality (#4414) 2025-07-21 12:33:06 +03:00
Jannik Clausen
51e185459a dialect/sql/schema: add option to control symbol hashing logic for schema dump (#4411) 2025-07-10 09:32:25 +02:00
Henry Le
ace82484b8 dialect/sql/sqlgraph: report check constraint violation with IsCheckConstraintError (#4404)
* feat(dialect): Support check constraint violation

* chore: Add unit tests for IsCheckConstraintError
2025-06-20 15:11:59 +07:00
Jannik Clausen
eec2a183c0 dialect/sql/schema: resource positions: remove unnecessary function a… (#4391)
* dialect/sql/schema: resource positions: remove unnecessary function argument

* fix linter
2025-05-21 15:19:30 +02:00
Jannik Clausen
c12502dba5 dialect: support atlas external schema resource positions (#4390) 2025-05-20 14:12:53 +02:00
Giau. Tran Minh
b1786895ce dialect/sql: remove all DDL builders that no longer used (#4369) 2025-04-08 19:44:03 +07:00
Ariel Mashraki
95a3e5f970 dialect/sql: reset session variables when query is done (#4364) 2025-03-28 06:21:31 +03:00
Jannik Clausen
c877aa65c4 dialect/sql/schema: revert min length logic for state reader (#4359)
While this change is correct and eventually should land, currently it is creating too many noise in existing projects. Therefore, this change is reverted until a better solution is found.
2025-03-21 19:32:06 +01:00
Jannik Clausen
80f9cbf5bf dialect/sql/schema: qualify if schema is given (#4346) 2025-03-10 14:24:01 +01:00
Jannik Clausen
fed373ab2f dialect/sql/schema: support dialect specific view definitions (#4340) 2025-02-24 13:43:19 +01:00
MengYX
428604afd7 fix: ent schema panics if any field contains the DefaultExprs annotation (#4338)
fixes https://github.com/ent/ent/issues/4337
2025-02-24 08:19:12 +01:00
Jannik Clausen
8b85c83e00 dialect/sql/schema: add multi schema and view support for schema dump (#4335) 2025-02-21 15:16:17 +01:00
Ariel Mashraki
c5db03c30e dialect/sql/schema: support setting schema name for migration (#4327) 2025-02-12 18:18:03 +02:00
Jannik Clausen
0edce5f3d6 entc/gen: resolve merge conflicts on global id file (#4312) 2025-01-23 13:59:47 +01:00
Jannik Clausen
4478d3ccb3 cmd/entfix: add utility binary entfix (#4306)
* cmd/entfix: add utility binary entfix

First command is 'entfix globalid' which will convert an existing ent_types table to the globalid ent feature.

* CR
2025-01-20 15:07:31 +01:00
Tobias Krischer
f9572c6f18 fix: use bigint for uint32 and uint16 in postgres driver (#4301) 2025-01-16 21:26:06 +02:00
Jannik Clausen
b91f8daf0e dialect/sql/schema: remove package prefix from globalid error (#4299) 2025-01-16 11:39:11 +01:00
Jannik Clausen
05c977357f dialect/sql/schema: add schema dump command (#4296)
* dialect/sql/schema: add schema dump command

* entc/gen/template: drop build flag from generated globalid.go
2025-01-15 16:24:02 +01:00
Jannik Clausen
01e21a2c30 dialect/sql/schema: remove deprecated legacy migration engine (#4294) 2025-01-14 12:57:51 +01:00
Jannik Clausen
adfd86c303 dialect/entsql: allow to define auto increment start value (#4292)
Preparation to rewrite the universal id feature to rely on type ranges defined statically in the schema instead of dynamically in a database.
2025-01-09 20:03:39 +01:00
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
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
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