Massage the Tables
Massage the ContentMirror tables
Short-cut: Just use this file: Massage ContentMirror Tables for Django
For each of the ContentMirror tables, there must be an ID field that has unique values, in order for Django to use the data.
Tables affected in this attempt:
- atbtreefolder
- atdocument
- atevent
- atfavorite
- atfile
- atfolder
- atimage
- atlink
- atnewsitem
- files
- relations
So, repeat these steps for almost all of the tables (excluding Content, which has ID built-in), replacing sometable with the actual table name.
- Create a sequence to be used by the new ID field.
CREATE SEQUENCE sometable_id_seq;
- Add the ID field to the table.
ALTER TABLE sometable ADD id INT UNIQUE;
- Make the ID field auto-increment.
ALTER TABLE sometable ALTER COLUMN id SET DEFAULT NEXTVAL('sometable_id_seq'); - Update the data values in the ID field.
UPDATE sometable SET id = NEXTVAL('sometable_id_seq');
Steps taken from this blog post:
http://pointbeing.net/weblog/2008/03/mysql-versus-postgresql-adding-an-auto-increment-column-to-a-table.html
