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 altering columns in SQLite migrations by RENAME-ADD-UPDATE-DROP #333

Open
Rongronggg9 opened this issue Apr 20, 2024 · 1 comment

Comments

@Rongronggg9
Copy link

Since 7bcf9b2, dropping columns in SQLite migrations is possible. We may further support altering columns in SQLite by:

ALTER TABLE "foo" RENAME COLUMN "bar" TO "bar_random_string";
ALTER TABLE "foo" ADD "bar" NEW_TYPE NOT NULL  DEFAULT "baz" /* comment */;
-- Do not CAST(x as JSON): https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/2011
UPDATE "foo" SET "bar" = CAST("bar_random_string" as NEW_TYPE);
ALTER TABLE "foo" DROP COLUMN "bar_random_string";
@UpstreamData
Copy link

+1. Would love to see this, mainly for migrating fields to allow null.

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