Commit Graph

258 Commits

Author SHA1 Message Date
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
Ariel Mashraki
15bebe8d89 ent: support schema view (#4157) 2024-07-28 19:00:47 +03: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
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
91c7fcc685 dialect/sql/schema: allow only table creation modification in automatic schema planning (#3660) 2023-07-26 11:24:33 +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
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
Jannik Clausen
55e98b5b9b dialect/sql/schema: mock result in write driver if returning clause is present (#3369) 2023-03-07 10:43:01 +01:00
Jannik Clausen
809b22be7c dialect/sql/schema: strip returning from seed (#3367) 2023-03-07 07:46:34 +01:00
Ariel Mashraki
7e2da46e09 dialect/sql/schema: expand fmt.Stringer args in WriteDriver (#3366) 2023-03-04 23:05:16 +02:00
Ariel Mashraki
3b7715b552 dialect/sql/schema: allow setting table comments (#3365) 2023-03-04 20:50:26 +02:00
Ariel Mashraki
f16451eab8 dialect/sql/schema: allow planning with indentation (#3363) 2023-03-04 10:06:53 +02:00
Ariel Mashraki
bd6f26aa7c dialect/sql/schema: allow configuring Atlas to return ErrNoPlan (#3322) 2023-02-16 21:56:51 +02:00
Ariel Mashraki
4e05f76717 dialect/sql: minor changes to allow using Migrate externally (#3316) 2023-02-14 15:06:36 +02:00
Ariel Mashraki
4c87e262a6 dialect/sql/schema: use the Atlas as state reader (#3314) 2023-02-14 10:20:34 +02:00
blukai
349b950978 dialect/sql/schema: ensure consistency of NotCleanError (#3310)
* dialect/sql/schema: ensure consistency of NotCleanError

For https://github.com/ariga/atlas/pull/1454

* get rid of cerr var

https://github.com/ariga/atlas/pull/1454#discussion_r1102391750
2023-02-10 13:25:53 +01:00
Ariel Mashraki
7ed84a86a8 dialect/sql/schema: skip destructive table changes (#3253)
This will be fixed also in Atlas, but having this extra safety here feels safer
2023-01-19 15:33:17 +02:00
Ariel Mashraki
136807549d dialect/entsql: supports setting SQL column comments (#3191)
* feat: Add column comment in SQL DDL, using EntSQL annotations to achieve it.

* Update annotation.go

* fix lint

* Add table primary key column comment

* entsql.Comment(string)  is unnecessary

* entc/gen: minor changes to entsql.WithComments + add tests

Co-authored-by: chenghonour <wantto@outlook.com>
2022-12-26 14:48:37 +02:00
Pedro Henrique
3f4916ff8b dialect/sql/schema: fix issue with WriteDriver when using Postgres with Query (#3162) 2022-12-09 21:08:55 +02:00
Pedro Henrique
397afc3d85 dialect/sql/schema: avoid setting the primary key when no primary key is present (#3114)
* dialect/sql: avoid setting the primary key when no primary key is present

* fix tests

* adds comment
2022-11-28 06:48:00 +02:00
Ariel Mashraki
f7109f0274 dialect/sql/schema: make WriteDriver friendlier (#3119)
Also, add a guide for writing and executing data migrations files.
2022-11-27 13:27:15 +02:00
Ariel Mashraki
5954fa8b15 dialect/sql/schema: normalize ent/schema (desired state) on replay mode (#3100) 2022-11-16 20:01:36 +02:00
Ariel Mashraki
891fc8fecf dialect/sql/schema: support setting default value expressions on id fields (#3089) 2022-11-13 18:55:04 +02:00
Ariel Mashraki
1e5f68646f dialect/sql/entsql: support setting expression as column default value
Fixed https://github.com/ent/ent/issues/3069
2022-11-12 14:38:33 +02:00
Ariel Mashraki
3b5a535801 dialect/sql/schema: allow setting JSON default values on pg, sqlite and maria (#3081) 2022-11-11 07:41:21 +02:00
Ariel Mashraki
eae7d390a9 dialect/sql: add support for index operator-class using atlasgo.io (#3073) 2022-11-08 14:08:10 +02:00
Jannik Clausen
c41d223733 dialect/sql/schema: disable foreign keys before opening a transaction (#2966)
* dialect/sql/schema: disable foreign keys before opening a transaction

* dialect/sql/schema: disable foreign keys before opening a transaction

* fix tests

* add test for bug

* apply CR
2022-09-28 07:41:49 +02:00
Ariel Mashraki
e93e96ed1b dialect/sql/schema: use serial underlying types for fks (#2963) 2022-09-27 07:54:07 +03:00
Jannik Clausen
139725ee00 dialect/sql/schema: no longer allocate a PK range for a join table (#2950)
* dialect/sql/schema: no longer allocate a PK range for a join table

* test that no breaking change is introduced
2022-09-23 13:40:36 +03:00
Ariel Mashraki
3fc4ba6f15 dialect/entsql: add support for partial indexes (#2944) 2022-09-20 15:07:28 +03:00
Ariel Mashraki
cfb038810d dialect/sql/entsql: support including non-key columns in postgres indexes (#2912) 2022-09-07 22:09:48 +03:00
Ariel Mashraki
2c63d1d70e all: gofmt -w -r 'interface{} -> any' (#2874) 2022-08-19 18:23:04 +03:00
Jannik Clausen
b6c185a660 dialect/sql/schema: make use of new atlas migration directories and r… (#2873)
* dialect/sql/schema: make use of new atlas migration directories and remove examples for custom formatters

* typo
2022-08-19 14:42:54 +02:00
Ariel Mashraki
1c01301de1 sql/dialect/schema: support setting PK to serial types in postgres (#2748) 2022-07-13 14:40:56 +03:00
Jannik Clausen
bc623b3f64 all: update atlas (#2739) 2022-07-11 15:25:14 +02:00
Jannik Clausen
412f5f75ca add docs about auto-increment counter "bug" in MySQL versions < 8.0 and how to handle it (#2722) 2022-07-06 10:34:39 +02:00
Ariel Mashraki
2c1a3555cc entc/gen: ignore edge-fields order in edge-schema with composite identifiers (#2719)
This PR allows defining edge schemas with any order of their edges
but still enforce the ordering of the fields in the ID annotation
2022-07-05 15:45:28 +03:00
Jannik Clausen
5b67bdab4f dialect/sql/schema: atlas engine is now default (#2698)
* atlas engine is default, enabled diff by replay

* Apply suggestions from code review

* docs

* apply CR
2022-07-05 12:29:15 +02:00
Ariel Mashraki
8416fb502d dialect/sql/schema: setup tables before running migrate diff (#2703)
Keep the same API as schema.Create
2022-06-30 09:55:40 +03:00
Ariel Mashraki
311d760679 entc/gen: allow opening and testing concurrent enttest clients (#2665) 2022-06-20 08:32:30 +03:00
Ariel Mashraki
98d00a35b5 go: update atlas and test global-unique-id migration (#2661) 2022-06-18 21:50:44 +03:00