sqlalchemy / sqlalchemy/alembic

Handle AUTOINCREMENT modification detection in revision auto-generation

Open
#1,224 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

autogenerate - detection autogenerate - rendering mysql use case
Dominant language
Python
Stars
4.4k
Forks
375
PR merge metrics
No merged PRs in 30d

Description

Describe the use case
Unless I'm mistaken, toggling the autoincrement attribute of a table column is not detected by the revision auto-generation.

Databases / Backends / Drivers targeted
My usecase is for MySQL databases, but I guess it would be nice to have for any DB that supports this feature (although I'm not familiar with which DBs that would be).

Example Use
Migrate from

CREATE TABLE `FOO` (
  `ID` int(11) NOT NULL,
  PRIMARY KEY (`ID`)
);

to

CREATE TABLE `FOO` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`ID`)
);

would generate a difference in a migration script.

Have a nice day!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the MySQL example in revision auto-generation, comparing a table whose column lacks AUTO_INCREMENT with one that includes it. Trace how the schema difference is detected and confirm that the generated migration represents toggling the autoincrement attribute.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, python, sqlalchemy
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.