Commit d0fbf12c authored by Claude Paroz's avatar Claude Paroz

Removed osbolete notes about upgrading

parent e30e9a9b
## r1226
Add this attribute to Team to be able to run the snippet:
coordinator = models.ForeignKey(Person)
./manage.py shell
from teams.models import *
from people.models import *
for t in Team.objects.all():
p = t.coordinator
r = Role(team=t, person=p, role='coordinator')
r.save()
Remove the previous added attribute.
SQL command
ALTER TABLE team DROP coordinator_id;
## r1229
ALTER TABLE statistics ADD UNIQUE ("branch_id", "domain_id", "language_id");
## r1402
# For MySQL
# decouple team from auth_group:
ALTER TABLE team ADD `id` int(11) NOT NULL FIRST;
ALTER TABLE team ADD UNIQUE(`id`);
ALTER TABLE team ADD `name` varchar(50) NOT NULL AFTER id;
UPDATE team INNER JOIN auth_group ON team.group_ptr_id=auth_group.id SET team.id=auth_group.id;
UPDATE team INNER JOIN auth_group ON team.group_ptr_id=auth_group.id SET team.name=auth_group.name;
# replace foreign key names with those of your db
ALTER TABLE team DROP FOREIGN KEY `group_ptr_id_refs_id_5511b014501b060`;
ALTER TABLE language DROP FOREIGN KEY `team_id_refs_group_ptr_id_66eefe8fd7bd994`;
ALTER TABLE language ADD FOREIGN KEY (`team_id`) REFERENCES `team` (`id`);
ALTER TABLE team DROP group_ptr_id;
ALTER TABLE team MODIFY `id` int(11) NOT NULL auto_increment;
ALTER TABLE team ADD primary key(`id`);
## For PostgreSQL (simpler :)
ALTER TABLE team ADD id SERIAL NOT NULL;
ALTER TABLE team ADD name VARCHAR(50);
UPDATE team t SET id = ag.id FROM auth_group ag WHERE t.group_ptr_id = ag.id;
UPDATE team t SET name = ag.name FROM auth_group ag WHERE t.group_ptr_id = ag.id;
ALTER TABLE team ADD UNIQUE(id);
ALTER TABLE team ALTER name SET NOT NULL;
ALTER TABLE team DROP group_ptr_id CASCADE;
ALTER TABLE language ADD FOREIGN KEY (team_id) REFERENCES team(id);
## r1412
# For MySQL
ALTER TABLE statistics ADD num_figures int(11) NOT NULL DEFAULT 0;
# For PostgreSQL
ALTER TABLE statistics ADD num_figures int NOT NULL DEFAULT 0;
# migration script to populate num_figures for POT files
import os
from stats.utils import run_shell_command
from stats.models import Statistics
stats = Statistics.objects.filter(language=None, domain__dtype='doc')
for stat in stats:
pofile = stat.po_path(potfile=True)
if os.access(pofile, os.R_OK):
command = "grep '^msgid \"@@image:' \"%s\" | wc -l" % pofile
(status, output, errs) = run_shell_command(command)
num = int(output)
if num > 0:
stat.num_figures = num
stat.save()
## r1447
ALTER TABLE information MODIFY `type` VARCHAR(10) NOT NULL;
ALTER TABLE archived_information MODIFY `type` VARCHAR(10) NOT NULL;
## Rename archives tables
ALTER TABLE archived_statistics RENAME TO statistics_archived;
ALTER TABLE archived_information RENAME TO information_archived;
ALTER TABLE action_backup RENAME TO action_archived;
UPDATE action_archived SET name = 'AA' where name = 'BA';
# For PostgreSQL
ALTER INDEX action_backup_pkey RENAME TO action_archived_pkey;
ALTER INDEX archived_information_pkey RENAME TO information_archived_pkey;
ALTER INDEX archived_statistics_pkey RENAME TO statistics_archived_pkey;
ALTER SEQUENCE action_backup_id_seq RENAME TO action_archived_id_seq;
ALTER SEQUENCE archived_information_id_seq RENAME TO information_archived_id_seq;
ALTER SEQUENCE archived_statistics_id_seq RENAME TO statistics_archived_id_seq;
## Add language plural forms
ALTER TABLE language ADD plurals VARCHAR(200);
# Add new linguas_location field
ALTER TABLE domain ADD linguas_location VARCHAR(50);
ALTER TABLE domain MODIFY `pot_method` VARCHAR(100);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment