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

Error with key-dropping and auto_increment keys #309

Open
aredridel opened this issue Jun 3, 2014 · 1 comment
Open

Error with key-dropping and auto_increment keys #309

aredridel opened this issue Jun 3, 2014 · 1 comment

Comments

@aredridel
Copy link
Contributor

SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key
Full context of command:
ALTER TABLE ReportDetail
    DROP PRIMARY KEY,
--  WAS KEY reportingUserNo (reportingUserNo,reportedUserNo),
    DROP KEY reportingUserNo,
--  WAS KEY dateReported (dateReported),
    DROP KEY dateReported,
    ADD COLUMN reportNo INT UNSIGNED NOT NULL auto_increment FIRST,
--  BEFORE        reason INT NOT NULL DEFAULT 0,
    MODIFY COLUMN reason INT UNSIGNED NOT NULL DEFAULT 0
@iarna
Copy link
Contributor

iarna commented Jun 7, 2014

So, our conclusion was:

What's happening is that we changed the primary key, adding an auto_increment. Modyllic generates a DROP, followed by a change and does an add separately. This separation is (was?) required by other classes of table change limits. (This requirement may have been eliminated by the separation of all foreign key actions.)

As such, there are two ways forward. Either we can defer adding the auto_increment attribute to a later command, or we can see if we can add the primary key as part of this alter command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants