Commit Graph

73 Commits

Author SHA1 Message Date
张凯强 21e85b89d6
Fix create with ignore migration () 2021-08-09 13:23:44 +08:00
heige 9e5a4e30b4
Fix migrator GuessConstraintAndTable method for return value for *schema.Check () 2021-08-03 11:40:57 +08:00
heige 413fe587c6
Optimize migrator.go MigrateColumn and ColumnTypes func. () 2021-08-02 18:44:10 +08:00
heige 5115813c50
Fix preload fmt.Errorf formatter () 2021-07-28 18:50:08 +08:00
s-takehana 2202e99cbf
Fix create index with comments in MySQL ()
* Fix create index with comments in MySQL

* Fix tests
2021-07-18 11:47:44 +08:00
heige 50e85e14d4
Code optimize ()
* 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 ()
continue https://github.com/go-gorm/gorm/pull/4028
2021-04-13 09:39:43 +08:00
heige 07f3795f93
optimize MigrateColumn method for regexp () 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 ()
* 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 2021-01-26 13:39:34 +08:00
Jinzhu 59c01b7943 Make migrator works with dbresolver, close 2021-01-25 10:30:57 +08:00
Jinzhu f8bd4c4875 Don't create index if there are error exist, close 2021-01-24 10:23:04 +08:00
Jinzhu 6095dbf939 Fix parse embedded relations, close , 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 2020-11-05 11:43:21 +08:00
Jinzhu dd92f8bdc0 Allow create table for other database/schema 2020-10-23 11:01:45 +08:00
Jinzhu 0aef8acc11 Add smart auto migrate tests 2020-10-22 16:36:27 +08:00
Jinzhu 5fee5b1b24 Add option tag support for index 2020-10-21 20:18:21 +08:00
Michelle 635dcc9ad4
add gorm ColumnType interface, remove sql one () 2020-10-21 18:35:33 +08:00
Jinzhu 089939c767 AutoMigrate should auto create indexes, close 2020-09-18 21:50:11 +08:00
Jinzhu 619d306cef ignore (-) when creating default values, 2020-09-10 10:55:02 +08:00
Jinzhu 567597f000 Fix fail on sqlserver, 2020-09-09 10:53:13 +08:00
Jonathan A. Sternberg 222427c474
Release the connection when discovering the column types in the migrator
When the migrator is used to discover the column types, such as when
used with `AutoMigrate()`, it does not close the query result. This
changes the migrator to close the query result and it also changes the
query to use `LIMIT 1` to prevent additional work against the database
when only discovering the schema.

Fixes .
2020-09-08 18:12:14 -05:00
Jinzhu c9d5c0b07a Fix create database foreign keys for same type having has many/one & many2many relationships, close 2020-09-08 18:25:29 +08:00
Jinzhu d1e17d549f request ColumnTypes after new session method 2020-09-01 20:53:54 +08:00
Jinzhu 22317b43c0 Fix migrate field, failed to migrate when field size changed 2020-09-01 18:58:16 +08:00
Jinzhu 0273856e4d Don't alter column with full column data type, close 2020-08-31 16:27:27 +08:00
Jinzhu cc6a64adfb Support smart migrate, close 2020-08-23 18:16:12 +08:00
Jinzhu ff985b90cc Fix failed to guess relations for embedded types, close 2020-08-04 12:25:34 +08:00
Jinzhu 4456df7a5d Lint with golangci-lint 2020-07-16 11:27:12 +08:00
Jinzhu 30188e7aa4 CHECK constraint without parentheses 2020-07-08 18:15:45 +08:00
Jinzhu f2b49437fb Test set string field's default value to blank string 2020-06-25 22:48:10 +08:00
Jinzhu 1b28c187c0 Fix create with default value 2020-06-25 08:00:10 +08:00
Jinzhu 4a01d4c263 Create join table with ReorderModels 2020-06-24 17:19:11 +08:00
Jinzhu 4201f7bdab Fix create unique index when creating table, close 2020-06-23 22:14:41 +08:00
Jinzhu 5d044642d1 Allow DisableForeignKeyConstraintWhenMigrating 2020-06-22 11:04:44 +08:00
Jinzhu d0764bead1 Test migrate with comment and check created constraints 2020-06-21 13:59:43 +08:00
Jinzhu fee1e4aafd Fix create foreign keys for many2many relations 2020-06-21 10:48:23 +08:00
Jinzhu a1e35bdc94 Support merge batch data some having primary values 2020-06-20 16:52:15 +08:00
Jinzhu 4f19e2a7b3 Test ForeignKeyConstraints 2020-06-20 01:20:18 +08:00
Jinzhu 96368eb967 Test embedded struct implements Scan & Value interface 2020-06-18 09:15:23 +08:00
Jinzhu 6b2f37189e Fix few cases with postgres 2020-06-18 08:40:41 +08:00
Jinzhu 1fdc66710e Add table options 2020-06-14 19:13:16 +08:00
Jinzhu a954d772d7 Support customize gorm field type 2020-06-06 10:47:32 +08:00
Jinzhu 1490a062db Refactor codebase and add benchmark test 2020-06-05 23:26:56 +08:00
Jinzhu e986371a42 Rename package name 2020-06-02 09:18:01 +08:00
Jinzhu 5ecbf25b22 Drop table with CASCADE option 2020-06-02 07:56:53 +08:00