Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddl:support alter table comment #6127

Merged
merged 16 commits into from
Apr 2, 2018
Merged

Conversation

ciscoxll
Copy link
Contributor

@ciscoxll ciscoxll commented Mar 23, 2018

Added a command support alter table comment respond issues #4990 alter table mytable comment 'this is table comment';.

@ciscoxll ciscoxll added the DDL label Mar 23, 2018
@ciscoxll
Copy link
Contributor Author

@zimulala @winkyao PTAL

@winkyao
Copy link
Contributor

winkyao commented Mar 24, 2018

What is the related github issue?

@ciscoxll
Copy link
Contributor Author

@winkyao issues #4990

model/ddl.go Outdated
@@ -45,6 +45,7 @@ const (
ActionRenameTable ActionType = 14
ActionSetDefaultValue ActionType = 15
ActionShardRowID ActionType = 16
ActionSetTableComment ActionType = 17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ActionSetTableComment/ActionModifyTableComment/

ddl/table.go Outdated
@@ -335,6 +335,30 @@ func (d *ddl) onRenameTable(t *meta.Meta, job *model.Job) (ver int64, _ error) {
return ver, nil
}

func (d *ddl) onSetTableComment(t *meta.Meta, job *model.Job) (ver int64, _ error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/onSetTableComment/onModifyTableComment/

ddl/ddl_api.go Outdated
@@ -1436,6 +1439,31 @@ func (d *ddl) AlterColumn(ctx sessionctx.Context, ident ast.Ident, spec *ast.Alt
return errors.Trace(err)
}

func (d *ddl) TableComment(ctx sessionctx.Context, ident ast.Ident, spec *ast.AlterTableSpec) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/TableComment/AlterTableComment/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comments before exported method

ddl/ddl_api.go Outdated
TableID: tb.Meta().ID,
Type: model.ActionSetTableComment,
BinlogInfo: &model.HistoryInfo{},
Args: []interface{}{schema.ID, spec.Name, spec.Comment},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arg schema.ID is unnecessary, you can use job.SchemaID

@ciscoxll
Copy link
Contributor Author

@zimulala @winkyao PTAL

ddl/table.go Outdated
func (d *ddl) onModifyTableComment(t *meta.Meta, job *model.Job) (ver int64, _ error) {
var tableName string
var comment string
if err := job.DecodeArgs(&tableName, &comment); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tableName is useless?

@ciscoxll ciscoxll requested a review from zimulala March 27, 2018 05:07
@ciscoxll
Copy link
Contributor Author

@zimulala @winkyao PTAL

@ciscoxll
Copy link
Contributor Author

@zimulala PTAL

Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@winkyao winkyao added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 29, 2018
ddl/table.go Outdated
tblInfo.Comment = comment
ver, err = updateVersionAndTableInfo(t, job, tblInfo, true)
if err != nil {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this blank line.

}

tb, err := is.TableByName(ident.Schema, ident.Name)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some tests like TestMySQLErrorCode in ddl_db_test.go

@ciscoxll
Copy link
Contributor Author

@zimulala PTAL

@alivxxx
Copy link
Contributor

alivxxx commented Mar 30, 2018

/run-integration-common-test tidb-test=pr/481
/run-common-test tidb-test=pr/481

@ciscoxll
Copy link
Contributor Author

/run-all-tests

@coocood
Copy link
Member

coocood commented Mar 31, 2018

/run-all-tests

@shenli
Copy link
Member

shenli commented Apr 1, 2018

@coocood @zimulala PTAL

Copy link
Member

@coocood coocood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@coocood coocood merged commit a6976c0 into pingcap:master Apr 2, 2018
@ciscoxll ciscoxll added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 2, 2018
@ciscoxll ciscoxll deleted the alter-table-comment branch May 10, 2018 12:22
@sre-bot sre-bot added the contribution This PR is from a community contributor. label Dec 18, 2019
@you06 you06 added the sig/sql-infra SIG: SQL Infra label Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. sig/sql-infra SIG: SQL Infra status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants