Merge pull request #1138 from github/changlog-table-comment

Changlog table comment
This commit is contained in:
dm-2 2022-07-07 15:47:21 +01:00 committed by GitHub
commit 78da0d09c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2021 GitHub Inc. Copyright 2022 GitHub Inc.
See https://github.com/github/gh-ost/blob/master/LICENSE See https://github.com/github/gh-ost/blob/master/LICENSE
*/ */
@ -22,7 +22,8 @@ import (
) )
const ( const (
atomicCutOverMagicHint = "ghost-cut-over-sentry" GhostChangelogTableComment = "gh-ost changelog"
atomicCutOverMagicHint = "ghost-cut-over-sentry"
) )
type dmlBuildResult struct { type dmlBuildResult struct {
@ -233,16 +234,16 @@ func (this *Applier) CreateChangelogTable() error {
return err return err
} }
query := fmt.Sprintf(`create /* gh-ost */ table %s.%s ( query := fmt.Sprintf(`create /* gh-ost */ table %s.%s (
id bigint auto_increment, id bigint unsigned auto_increment,
last_update timestamp not null DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, last_update timestamp not null DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
hint varchar(64) charset ascii not null, hint varchar(64) charset ascii not null,
value varchar(4096) charset ascii not null, value varchar(4096) charset ascii not null,
primary key(id), primary key(id),
unique key hint_uidx(hint) unique key hint_uidx(hint)
) auto_increment=256 ) auto_increment=256 comment='%s'`,
`,
sql.EscapeName(this.migrationContext.DatabaseName), sql.EscapeName(this.migrationContext.DatabaseName),
sql.EscapeName(this.migrationContext.GetChangelogTableName()), sql.EscapeName(this.migrationContext.GetChangelogTableName()),
GhostChangelogTableComment,
) )
this.migrationContext.Log.Infof("Creating changelog table %s.%s", this.migrationContext.Log.Infof("Creating changelog table %s.%s",
sql.EscapeName(this.migrationContext.DatabaseName), sql.EscapeName(this.migrationContext.DatabaseName),