Code

Changes between Version 106 and Version 107 of RemovingTheMagic


Ignore:
Timestamp:
04/23/06 20:45:38 (8 years ago)
Author:
Ken Kennedy <kkennedy@…>
Comment:

This is NOT complete. There are data issues, and still a column change to deal with in SQLite properly.

Legend:

Unmodified
Added
Removed
Modified
  • RemovingTheMagic

    v106 v107  
    4747=== Rename core database tables === 
    4848 
    49 We've renamed a bunch of the core Django tables. To upgrade in MySQL and SQLite, execute this SQL in your database: 
     49We've renamed a bunch of the core Django tables. Due to functionality differences between the various database backends, the SQL to perform the necessary tasks varies slightly between engines.  
     50 
     51To upgrade in SQLite, execute this SQL in your database (some steps are more involved because SQLite has only limited ALTER TABLE functionality. We have to instead create working tables, move the data, and then replace the old tables with the new ones: 
     52 
     53{{{ 
     54ALTER TABLE auth_groups RENAME TO auth_group; 
     55ALTER TABLE auth_groups_permissions RENAME TO auth_group_permissions; 
     56ALTER TABLE auth_messages RENAME TO auth_message; 
     57ALTER TABLE auth_permissions RENAME TO auth_permission; 
     58ALTER TABLE auth_users RENAME TO auth_user; 
     59ALTER TABLE auth_users_groups RENAME TO auth_user_groups; 
     60ALTER TABLE auth_users_user_permissions RENAME TO auth_user_user_permissions; 
     61ALTER TABLE content_types RENAME TO django_content_type; 
     62ALTER TABLE core_sessions RENAME TO django_session; 
     63ALTER TABLE django_flatpages RENAME TO django_flatpage; 
     64ALTER TABLE django_flatpages_sites RENAME TO django_flatpage_sites; 
     65ALTER TABLE django_redirects RENAME TO django_redirect; 
     66ALTER TABLE sites RENAME TO django_site; 
     67 
     68CREATE TABLE "django_content_type_new"  ( 
     69"id" integer NOT NULL PRIMARY KEY, 
     70"name" varchar(100) NOT NULL, 
     71"app_label" varchar(100) NOT NULL, 
     72"model" varchar(100) NOT NULL, 
     73UNIQUE ("app_label", "model") 
     74); 
     75 
     76INSERT INTO django_content_type_new 
     77(id,name,app_label,model) 
     78SELECT id,name,package,python_module_name 
     79FROM django_content_type; 
     80 
     81 
     82ALTER TABLE django_content_type rename to django_content_type_old; 
     83ALTER TABLE django_content_type_new rename to django_content_type;  
     84 
     85DROP TABLE django_content_type_old;  
     86 
     87DROP TABLE packages; 
     88 
     89 
     90ALTER TABLE auth_permission ADD COLUMN content_type_id INTEGER; 
     91}}} 
     92 
     93To upgrade in MySQL , execute this SQL in your database: 
    5094 
    5195{{{