Code

Changes between Version 52 and Version 53 of RemovingTheMagic


Ignore:
Timestamp:
01/25/06 07:07:11 (8 years ago)
Author:
adrian
Comment:

Added PostgreSQL upgrade instructions

Legend:

Unmodified
Added
Removed
Modified
  • RemovingTheMagic

    v52 v53  
    1515=== Rename core database tables === 
    1616 
    17 We've renamed a bunch of the core Django tables. To upgrade, execute this SQL in your database: 
     17We've renamed a bunch of the core Django tables. To upgrade in MySQL and SQLite, execute this SQL in your database: 
    1818 
    1919{{{ 
     
    3434}}} 
    3535 
    36 WorldMaker: It seems that I needed to rename the associated id sequences (in Postgres) as well.  Is this standard?  Should this be added to the above SQL?  It should impact PostgreSQL installations the most, and apparently several versions won't properly rename the sequences. 
     36PostgreSQL is different, because you have to rename sequences, too. To upgrade in PostgreSQL, execute this SQL in your database: 
     37 
     38{{{ 
     39BEGIN; 
     40 
     41ALTER TABLE auth_groups RENAME TO auth_group; 
     42ALTER TABLE auth_groups_id_seq RENAME TO auth_group_id_seq; 
     43ALTER TABLE auth_group ALTER COLUMN id DROP DEFAULT; 
     44ALTER TABLE auth_group ALTER COLUMN id SET DEFAULT nextval('public.auth_group_id_seq'::text); 
     45 
     46ALTER TABLE auth_groups_permissions RENAME TO auth_group_permissions; 
     47ALTER TABLE auth_groups_permissions_id_seq RENAME TO auth_group_permissions_id_seq; 
     48ALTER TABLE auth_group_permissions ALTER COLUMN id DROP DEFAULT; 
     49ALTER TABLE auth_group_permissions ALTER COLUMN id SET DEFAULT nextval('public.auth_group_permissions_id_seq'::text); 
     50 
     51ALTER TABLE auth_messages RENAME TO auth_message; 
     52ALTER TABLE auth_messages_id_seq RENAME TO auth_message_id_seq; 
     53ALTER TABLE auth_message ALTER COLUMN id DROP DEFAULT; 
     54ALTER TABLE auth_message ALTER COLUMN id SET DEFAULT nextval('public.auth_message_id_seq'::text); 
     55 
     56ALTER TABLE auth_permissions RENAME TO auth_permission; 
     57ALTER TABLE auth_permissions_id_seq RENAME TO auth_permission_id_seq; 
     58ALTER TABLE auth_permission ALTER COLUMN id DROP DEFAULT; 
     59ALTER TABLE auth_permission ALTER COLUMN id SET DEFAULT nextval('public.auth_permission_id_seq'::text); 
     60 
     61ALTER TABLE auth_users RENAME TO auth_user; 
     62ALTER TABLE auth_users_id_seq RENAME TO auth_user_id_seq; 
     63ALTER TABLE auth_user ALTER COLUMN id DROP DEFAULT; 
     64ALTER TABLE auth_user ALTER COLUMN id SET DEFAULT nextval('public.auth_user_id_seq'::text); 
     65 
     66ALTER TABLE auth_users_groups RENAME TO auth_user_groups; 
     67ALTER TABLE auth_users_groups_id_seq RENAME TO auth_user_groups_id_seq; 
     68ALTER TABLE auth_user_groups ALTER COLUMN id DROP DEFAULT; 
     69ALTER TABLE auth_user_groups ALTER COLUMN id SET DEFAULT nextval('public.auth_user_groups_id_seq'::text); 
     70 
     71ALTER TABLE auth_users_user_permissions RENAME TO auth_user_user_permissions; 
     72ALTER TABLE auth_users_user_permissions_id_seq RENAME TO auth_user_user_permissions_id_seq; 
     73ALTER TABLE auth_user_user_permissions ALTER COLUMN id DROP DEFAULT; 
     74ALTER TABLE auth_user_user_permissions ALTER COLUMN id SET DEFAULT nextval('public.auth_user_user_permissions_id_seq'::text); 
     75 
     76ALTER TABLE content_types RENAME TO django_content_type; 
     77ALTER TABLE content_types_id_seq RENAME TO django_content_type_id_seq; 
     78ALTER TABLE django_content_type ALTER COLUMN id DROP DEFAULT; 
     79ALTER TABLE django_content_type ALTER COLUMN id SET DEFAULT nextval('public.django_content_type_id_seq'::text); 
     80 
     81ALTER TABLE core_sessions RENAME TO django_session; 
     82 
     83ALTER TABLE django_flatpages RENAME TO django_flatpage; 
     84ALTER TABLE django_flatpages_id_seq RENAME TO django_flatpage_id_seq; 
     85ALTER TABLE django_flatpage ALTER COLUMN id DROP DEFAULT; 
     86ALTER TABLE django_flatpage ALTER COLUMN id SET DEFAULT nextval('public.django_flatpage_id_seq'::text); 
     87 
     88ALTER TABLE django_flatpages_sites RENAME TO django_flatpage_sites; 
     89ALTER TABLE django_flatpages_sites_id_seq RENAME TO django_flatpage_sites_id_seq; 
     90ALTER TABLE django_flatpage_sites ALTER COLUMN id DROP DEFAULT; 
     91ALTER TABLE django_flatpage_sites ALTER COLUMN id SET DEFAULT nextval('public.django_flatpage_sites_id_seq'::text); 
     92 
     93ALTER TABLE django_redirects RENAME TO django_redirect; 
     94ALTER TABLE django_redirects_id_seq RENAME TO django_redirect_id_seq; 
     95ALTER TABLE django_redirect ALTER COLUMN id DROP DEFAULT; 
     96ALTER TABLE django_redirect ALTER COLUMN id SET DEFAULT nextval('public.django_redirect_id_seq'::text); 
     97 
     98ALTER TABLE packages RENAME TO django_package; 
     99 
     100ALTER TABLE sites RENAME TO django_site; 
     101ALTER TABLE sites_id_seq RENAME TO django_site_id_seq; 
     102ALTER TABLE django_site ALTER COLUMN id DROP DEFAULT; 
     103ALTER TABLE django_site ALTER COLUMN id SET DEFAULT nextval('public.django_site_id_seq'::text); 
     104 
     105COMMIT; 
     106}}} 
    37107 
    38108=== Database table-naming scheme has been changed === 
     
    44114As always, this behavior can be overridden on a per-model basis by specifying the {{{db_table}}} attribute in {{{class Meta}}} in your model. 
    45115 
    46 To upgrade, you'll either have to explicitly set {{{db_table}}} in your models or rename your database tables to fit the new naming scheme Django expects. 
     116To upgrade, you'll either have to explicitly set {{{db_table}}} in your models or rename your database tables to fit the new naming scheme Django expects. We'd recommend setting {{{db_table}}}, because it's easier. 
    47117 
    48118