Commit Graph

16 Commits

Author SHA1 Message Date
Bennett Amodio f482f25c71
fix: deterministic index ordering when migrating (#7208)
Issue: We observed that, when creating a database based on the same
gORM schema multiple times, indexes could appear in different orders,
hurting determinism for use-cases like schema comparison.

In order to fix this, it's simple to switch the ParseIndexes function
to return a list of indices rather than a map, so the callers will
iterate in deterministic order.
2024-12-06 10:27:44 +08:00
Ivan Ryabov 49bbaa637f
use map look-up for indexes (#7242) 2024-11-14 17:41:43 +08:00
black-06 46816ad31d
refactor: distinguish between Unique and UniqueIndex (#6386)
* refactor: distinguish between UniqueIndex and Index

* add test

* add ParseIndex test

* modify unique to constraint

* modify unique to constraint

* fix MigrateColumnUnique

* fix test

* fix unit test

* update test mod

* add MigrateColumnUnique to Migrator interface

* fix format lint

* add comment

* go mod tidy

* revert: revert MigrateColumn

* resolve conflicts
2024-02-04 15:49:19 +08:00
Haibo baf1afa1fc
fix(schema): field is only unique when there is one unique index (#5974) 2023-01-11 14:05:39 +08:00
Jinzhu 3d91802b1d Fix unexpected alter table in auto migration, close #5942, #5943 2023-01-02 21:06:04 +08:00
Chiung-Ming Huang 0211ac91a2
index: add composite id (#5269)
* index: add composite id

* index: add test cases of composite id

* index: improve the comments for the test cases of composite id
2022-04-25 11:39:23 +08:00
labulakalia 61b4c31236
fix when index name is "type", parseFieldIndexes will set index TYPE is "TYPE" (#5155)
* fix index name is type, parseFieldIndexes will set index TYPE is "TYPE"

* check TYPE empty
2022-03-14 21:47:59 +08:00
kinggo b47cf57f5e
ci: add gofumpt check in reviewdog (#4973) 2022-01-06 15:02:53 +08:00
Jinzhu 5fee5b1b24 Add option tag support for index 2020-10-21 20:18:21 +08:00
Jinzhu 619cd332ec Add index priority supports 2020-07-08 17:59:40 +08:00
Jinzhu 2416eabd3f Change unique_idnex to UniqueIndex 2020-07-04 00:36:27 +08:00
Jinzhu d0764bead1 Test migrate with comment and check created constraints 2020-06-21 13:59:43 +08:00
Jinzhu 7c0de9199c Test Migrate Indexes 2020-05-30 22:43:41 +08:00
Jinzhu d39bdc3513 Fix create index 2020-04-03 07:57:52 +08:00
Jinzhu ea0b13f7a3 Refactor ParseTagSetting 2020-02-22 07:59:09 +08:00
Jinzhu ad419855e9 Parse Indexes 2020-02-21 23:51:38 +08:00