Commit Graph

105 Commits

Author SHA1 Message Date
fayvori 3c34bc2f59
refactor: Regex description (#6507)
* Mirror cleanup

* Regex description

---------

Co-authored-by: Ignat Belousov <ignatbelousov@Ignats-MacBook-Pro.local>
2023-08-07 16:35:19 +08:00
John Mai e61b98d696
feat: migrator support table comment (#6225)
* feat: migrator support table comment

* feat: migrator support tableType.It like ColumnTypes

* Avoid updating the go.mod file.

* Update tests_all.sh

* Update migrator.go

* remove Catalog() & Engine() methods.

* remove CatalogValue & EngineValue.

---------

Co-authored-by: Jinzhu <wosmvp@gmail.com>
2023-05-05 15:58:27 +08:00
jessetang 05bb9d6106
refactor(migrator): non-standard codes (#6180) 2023-04-11 10:32:46 +08:00
black-06 a80707de9e
Create and drop view (#6097)
* create view

* add comment

* fix test

* check param and add comment
2023-02-27 15:43:10 +08:00
Michael Anstis 532e9cf4cc
Issue 6054: Unscoped not working with PreLoad on Joins (#6058)
* Issue 6054: Unscoped not working with PreLoad on Joins

* Formatting

---------

Co-authored-by: Michael Anstis <manstis@redhat.com>
2023-02-18 09:06:43 +08:00
Jinzhu 3d91802b1d Fix unexpected alter table in auto migration, close #5942, #5943 2023-01-02 21:06:04 +08:00
Haibo 16a272209a
fix(migrator): Tag default:'null' always causes field migration #5953 (#5954)
* fix(migrator): Tag default:'null' always causes field migration #5953

* Update migrate_test.go

* Update migrate_test.go

* Update migrate_test.go

Co-authored-by: Jinzhu <wosmvp@gmail.com>
2023-01-01 22:14:28 +08:00
Haibo da2b2861de
fix(migrator): ignore relationships when migrating #5913 (#5946) 2023-01-01 19:54:28 +08:00
Defoo Li 775fa70af5
DryRun for migrator (#5689)
* DryRun for migrator

* Update migrator.go

* Update migrator.go

Co-authored-by: Jinzhu <wosmvp@gmail.com>
2022-12-24 12:14:23 +08:00
Ning bbd2bbe521
fix:Issue migrating field with CURRENT_TIMESTAMP (#5906)
Co-authored-by: ningfei <accelerator314@outlook.com>
2022-12-24 11:02:11 +08:00
viatoriche / Maxim Panfilov 62593cfad0 add test: TestAutoMigrateInt8PG: shouldn't execute ALTER COLUMN TYPE smallint, close #5762 2022-10-18 17:28:06 +08:00
Cr 73bc53f061
feat: migrator support type aliases (#5627)
* feat: migrator support type aliases

* perf: check type
2022-09-22 15:56:32 +08:00
Cr 5ed7b1a65e
fix: same embedded filed name (#5705) 2022-09-22 11:25:03 +08:00
Googol Lee edb00c10ad
AutoMigrate() should always migrate checks, even there is no relationship constraints. (#5644)
* fix: remove uuid autoincrement

* AutoMigrate() should always migrate checks, even there is no relationship constranits.

Co-authored-by: a631807682 <631807682@qq.com>
2022-09-14 10:26:51 +08:00
Jiepeng Cao b3eb1c8c51
simplified regexp (#5677) 2022-09-05 15:39:19 +08:00
Cr 235c093bb9
fix(MigrateColumn):declared different type without length (#5465) 2022-06-29 10:07:42 +08:00
qqxhb 1305f637f8
feat: add method GetIndexes (#5436)
* feat: add method GetIndexes

* feat: add default impl for Index interface

* feat: fmt
2022-06-17 11:00:57 +08:00
Cr 93986de8e4
fix: migrate column default value (#5359)
Co-authored-by: Jinzhu <wosmvp@gmail.com>
2022-05-28 23:09:13 +08:00
black-06 f5e77aab2f
fix: quote index when creating table (#5331) 2022-05-17 10:59:53 +08:00
Cr bd7e42ec65
fix: AutoMigrate with special table name (#5301)
* fix: AutoMigrate with special table name

* test: migrate with special table name
2022-04-27 21:13:48 +08:00
glebarez 395606ac7c
fix missing error-check in AutoMigrate (#5283) 2022-04-22 11:19:33 +08:00
Jin 9a4d10be64
style: fix coding typo (#5184) 2022-03-24 09:31:58 +08:00
Jinzhu 48ced75d1d Improve support for AutoMigrate 2022-02-19 23:42:20 +08:00
Jinzhu 0af95f509a Enhance migrator Columntype interface (#5088)
* Update Migrator ColumnType interface

* Update MigrateColumn Test

* Upgrade test drivers

* Fix typo
2022-02-19 17:02:53 +08:00
Jinzhu a0aceeb33e Migrator AlterColumn with full data type 2022-02-10 10:40:48 +08:00
halfcrazy f757b8fdc9
fix: auto migration column order unpredictable (#4980) 2022-01-06 18:55:20 +08:00
kinggo b47cf57f5e
ci: add gofumpt check in reviewdog (#4973) 2022-01-06 15:02:53 +08:00
Jinzhu 300a23fc31 Check rows.Close error, close #4891 2021-12-02 10:39:24 +08:00
Jinzhu 3a3b82263a Fix auto migration always alert table, close #4198 2021-11-29 20:24:16 +08:00
heige 9d5f315b6d
feat: go code style adjust and optimize code for callbacks package (#4861)
* feat: go code style adjust and optimize code for callbacks package

* Update scan.go
2021-11-29 09:33:20 +08:00
dino.ma 5e64ac7de9
feat(migrator,migrator/migrator.go,tests/migrate_test.go) : Get multiple data tables for migrator. (#4841)
* feat(migrator,migrator/migrator.go,tests/migrate_test.go) : Get multiple data tables for migrator.

* feat(migrator.go and migrator/migrator.go) : remove Table Struct replace with []string

* fix(migrator)  : Return all data tables

* Update migrator.go

* fix(migrator/migrator.go):remove var sql

* feat(migrate_test.go/go.mod):update sqlserver,sqlite,postgres,pq version and add getTables test

* fix(migrate_test.go):change GetTables Method Test,use intersection

Co-authored-by: dino.ma <mashengjie03@baidu.com>
2021-11-13 14:03:33 +08:00
Jason Lee d3211908a0
Refactor ParseWithSchemaTable method and improve test. (#4789)
* Refactor ParseWithSchemaTable method and improve test.

* Fix schema.ParseWithSchemaTable method for only use schemaTable in migrator and improve test.

* Rename `schemaTable` to `specialTableName` for clearly argument.
2021-10-25 11:26:44 +08:00
张凯强 21e85b89d6
Fix create with ignore migration (#4571) 2021-08-09 13:23:44 +08:00
heige 9e5a4e30b4
Fix migrator GuessConstraintAndTable method for return value for *schema.Check (#4527) 2021-08-03 11:40:57 +08:00
heige 413fe587c6
Optimize migrator.go MigrateColumn and ColumnTypes func. (#4532) 2021-08-02 18:44:10 +08:00
heige 5115813c50
Fix preload fmt.Errorf formatter (#4531) 2021-07-28 18:50:08 +08:00
s-takehana 2202e99cbf
Fix create index with comments in MySQL (#4521)
* Fix create index with comments in MySQL

* Fix tests
2021-07-18 11:47:44 +08:00
heige 50e85e14d4
Code optimize (#4415)
* optimize gormSourceDir replace

* fmt.Errorf adjust and Optimize for-break

* strings trim

* feat: avoid using the same name field and if..else optimization adjustment

* optimization callbacks/create.go Create func if...else logic

* fix: callbacks/create.go Create func

* fix FileWithLineNum func and add gormSourceDir unit test

* remove debug print and utils_filenum_test.go
2021-06-10 10:21:28 +08:00
yrong1997 d7911300f8
Respect ignore migration when add column (#4276)
continue https://github.com/go-gorm/gorm/pull/4028
2021-04-13 09:39:43 +08:00
heige 07f3795f93
optimize MigrateColumn method for regexp (#4188) 2021-03-17 11:32:17 +08:00
Jinzhu 3694ef4a2c Fix get current table 2021-02-26 17:30:00 +08:00
yrong1997 2ba612e805
Add field tag to ignore migration (#4028)
* Add field tag to ignore migration

* Fix null value with space

* refactor migration tag
2021-02-09 16:03:02 +08:00
Jinzhu 916338a9e1 Test migrate constraints, close #3986 2021-01-26 13:39:34 +08:00
Jinzhu 59c01b7943 Make migrator works with dbresolver, close #3992 2021-01-25 10:30:57 +08:00
Jinzhu f8bd4c4875 Don't create index if there are error exist, close #3976 2021-01-24 10:23:04 +08:00
Jinzhu 6095dbf939 Fix parse embedded relations, close #3964, #3965 2021-01-19 15:40:04 +08:00
Jinzhu 59730417aa Fix auto migrate field with customized field type, close https://github.com/go-gorm/mysql/issues/20 2020-12-23 17:31:47 +08:00
Jinzhu 557b874ee3 Fix check field's precision 2020-11-25 14:55:53 +08:00
Jinzhu 26504f5cae Use NewDB to replace WithConditions for Session 2020-11-17 16:28:37 +08:00
Jinzhu 85e9f66d26 Fix create index for other database/schema, close #3698 2020-11-05 11:43:21 +08:00