Re: Non-primary auto-incrementing field with Postgres

2017-06-21 Thread thauk
On Tuesday, June 20, 2017 at 10:40:05 PM UTC-7, Scot Hacker wrote: > > One strategy might be to: > > 1) Bring in the data under a different column name ('old_id' ?) > 2) In a single migration, drop the default ID column, rename old_id to > id, and give it primary_key=True > I can't change the p

Re: Non-primary auto-incrementing field with Postgres

2017-06-21 Thread Melvyn Sopacua
On Monday 19 June 2017 16:29:48 Thomas Hauk wrote: > I am working on a project that uses Django 1.10.5 with Postgres 9.6 > (and Python 3.6.1). > > I am currently migrating historical data from an old system into the > new system. This historical data has a table with a (non-primary key) > "ID" col

Re: Non-primary auto-incrementing field with Postgres

2017-06-20 Thread Scot Hacker
One strategy might be to: 1) Bring in the data under a different column name ('old_id' ?) 2) In a single migration, drop the default ID column, rename old_id to id, and give it primary_key=True That should preserve your old IDs and set the next auto_increment to the next highest value (and if

Non-primary auto-incrementing field with Postgres

2017-06-19 Thread Thomas Hauk
I am working on a project that uses Django 1.10.5 with Postgres 9.6 (and Python 3.6.1). I am currently migrating historical data from an old system into the new system. This historical data has a table with a (non-primary key) "ID" column. I would like to migrate these rows into the new databas