SQLAlchemy Migrate - Can I add (or change) a column to a specific position in an existing table?

I want to add a column to a specific position in an existing table or move one of the columns. But I can not find any method in Sqlalchemy-migrate.

I want to know methods equivalent to the following MySQL queries in sqlalchemy-migrate

ALTER TABLE tablename ADD column_name2 INT AFTER column_name1 ALTER TABLE tablename ADD column_name2 INT FIRST ALTER TABLE tablename MODIFY COLUMN column_name2 INT AFTER column_name1; 
+5
source share
1 answer

You need to follow these steps:

  • create a temporary table
  • copies of entries in temp table
  • rename temp to the source table.

During ALTER, internal operations are also performed.

0
source

Source: https://habr.com/ru/post/1234960/


All Articles