6

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

I want to know methods equivalent 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;
r-m-n
  • 14,192
  • 4
  • 69
  • 68
Daehee Kim
  • 61
  • 3

1 Answers1

0

You need to follow below steps:

  1. create temp table,
  2. copy records in temp table
  3. rename temp to original table.

During ALTER operation flow as well, these operation will be executed internally.

srana
  • 51
  • 3