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

Support changing multiple schema in ALTER TABLE #14766

Closed
30 of 39 tasks
zimulala opened this issue Feb 13, 2020 · 11 comments
Closed
30 of 39 tasks

Support changing multiple schema in ALTER TABLE #14766

zimulala opened this issue Feb 13, 2020 · 11 comments
Assignees
Labels
feature/accepted This feature request is accepted by product managers priority/P1 The issue has P1 priority. sig/sql-infra SIG: SQL Infra type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@zimulala
Copy link
Contributor

zimulala commented Feb 13, 2020

Feature Request

Is your feature request related to a problem? Please describe:

Currently TiDB only supports one schema change per SQL statement and, in a few cases, multi-schema changes.

Therefore, users often encounter incompatible DDLs when migrating from other databases. The only way is to rewrite a multi-schema DDL into several separated DDLs. For the users that rely on frameworks like "flyway", the rewrite is not even possible.

Describe the feature you'd like:

Support multiple schema changes in a single SQL statement, including ADD , ALTER , DROP and CHANGE for columns and indexes, and changes to table options. For example:

CREATE TABLE t (a INT, c INT);
ALTER TABLE t ADD COLUMN b INT, 
 MODIFY COLUMN c CHAR(5),
 ADD INDEX idx(a),
 ADD PRIMARY KEY (c),
 COMMENT = "comments for t";

Refer to https://dev.mysql.com/doc/refman/5.7/en/alter-table.html.

Describe alternatives you've considered:

Rewriting the SQL at application level works, but it is not suitable in all the cases.

Tasks

Design:

Refactoring:

Framework:

Key features:

Others:

Admin & Monitor

User docs:

Unsolved issues:

@IANTHEREAL
Copy link
Contributor

Cool! @july2993 @csuzhangxc please pay attention to this change.

We should consider the compatibility issues in tidb binlog replication, like replicating binlog from a newer version tidb cluster to old version tidb cluster.

@zimulala zimulala added sig/sql-infra SIG: SQL Infra and removed component/DDL1 labels Mar 4, 2020
@zz-jason zz-jason added type/feature-request Categorizes issue or PR as related to a new feature. and removed type/new-feature labels Apr 3, 2020
@scsldb scsldb added the priority/P0 The issue has P0 priority. label Jun 12, 2020
@scsldb scsldb added this to the v5.0-alpha milestone Jun 12, 2020
@scsldb scsldb removed the priority/P0 The issue has P0 priority. label Jun 12, 2020
@scsldb scsldb removed this from the v5.0-alpha milestone Jun 12, 2020
@zimulala
Copy link
Contributor Author

Related to #5166.

@zz-jason zz-jason added the feature/accepted This feature request is accepted by product managers label Jul 29, 2020
@bb7133 bb7133 added the priority/P1 The issue has P1 priority. label Oct 29, 2020
@eikodev
Copy link

eikodev commented Jul 28, 2022

Looking forward to this one so I can use TiDB with Prisma properly.

@tangenta tangenta changed the title Support the operation of adding multi-schema change in one statement Support changing multiple schema in ALTER TABLE Jul 28, 2022
@shtse8
Copy link

shtse8 commented Nov 11, 2022

Looking forward to this one so I can use TiDB with Prisma properly.

Me too. Although Tidb is 100% mysql compatible, without mutiple schema support, many Orms cannot function properly.

@dveeden
Copy link
Contributor

dveeden commented Nov 14, 2022

Maybe #39143 and #38453 should be added to the list of items?

@bb7133
Copy link
Member

bb7133 commented Nov 22, 2022

Close it since most changes have been supported already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/accepted This feature request is accepted by product managers priority/P1 The issue has P1 priority. sig/sql-infra SIG: SQL Infra type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.