-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
1 parent
32045fd
commit e61b98d
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package migrator | ||
|
||
import ( | ||
"database/sql" | ||
) | ||
|
||
// TableType table type implements TableType interface | ||
type TableType struct { | ||
SchemaValue string | ||
NameValue string | ||
TypeValue string | ||
CommentValue sql.NullString | ||
} | ||
|
||
// Schema returns the schema of the table. | ||
func (ct TableType) Schema() string { | ||
return ct.SchemaValue | ||
} | ||
|
||
// Name returns the name of the table. | ||
func (ct TableType) Name() string { | ||
return ct.NameValue | ||
} | ||
|
||
// Type returns the type of the table. | ||
func (ct TableType) Type() string { | ||
return ct.TypeValue | ||
} | ||
|
||
// Comment returns the comment of current table. | ||
func (ct TableType) Comment() (comment string, ok bool) { | ||
return ct.CommentValue.String, ct.CommentValue.Valid | ||
} |