python - duplicate table (identical) including primary key - using django south -
i'm using south data migration move data 1 table (between django apps)
its moving data suppose but, problem not duplication primary key (id), instead creating new 1 (in new table) make sense..
but how can make new table identical, including id field (which default, not defined in models)
using mysql
create table using like
in forwards
part, insert old table new one. in backwards
part drop new table.
def forwards(self, orm): db.execute("create table new_table old_table") db.execute("insert new_table select * old_table") def backwards(self, orm): db.drop_table('new_table')
hope helps.
Comments
Post a Comment