Changes between Version 43 and Version 44 of RemovingTheMagic


Ignore:
Timestamp:
Jan 22, 2006, 9:00:04 PM (19 years ago)
Author:
Adrian Holovaty
Comment:

Added notes about database table name changes.

Legend:

Unmodified
Added
Removed
Modified
  • RemovingTheMagic

    v43 v44  
    446446 * New: {{{from django.conf import settings}}}
    447447
    448 == Database table-name changes ==
    449 
    450 Renamed {{{core_sessions}}} table to {{{django_sessions}}}. To change, execute this SQL in your database:
    451 
    452 {{{
    453 ALTER TABLE core_sessions RENAME TO django_sessions;
    454 }}}
     448== Renamed core database tables ==
     449
     450'''Status: Done'''
     451
     452Renamed a bunch of the code Django tables. To upgrade, execute this SQL in your database:
     453
     454{{{
     455ALTER TABLE auth_groups RENAME TO auth_group;
     456ALTER TABLE auth_groups_permissions RENAME TO auth_group_permissions;
     457ALTER TABLE auth_messages RENAME TO auth_message;
     458ALTER TABLE auth_permissions RENAME TO auth_permission;
     459ALTER TABLE auth_users RENAME TO auth_user;
     460ALTER TABLE auth_users_groups RENAME TO auth_user_groups;
     461ALTER TABLE auth_users_user_permissions RENAME TO auth_user_user_permissions;
     462ALTER TABLE content_types RENAME TO django_content_type;
     463ALTER TABLE core_sessions RENAME TO django_session;
     464ALTER TABLE django_flatpages RENAME TO django_flatpage;
     465ALTER TABLE django_flatpages_sites RENAME TO django_flatpage_sites;
     466ALTER TABLE django_redirects RENAME TO django_redirect;
     467ALTER TABLE packages RENAME TO django_package;
     468ALTER TABLE sites RENAME TO django_site;
     469}}}
     470
     471== Changed database table naming scheme ==
     472
     473Database table names formerly were created by joining the app_label and module_name. Example: {{{polls_polls}}}.
     474
     475Because there's no longer any pluralization, database table names are now formed by joining the app_label and model name (singular). Example: {{{polls_poll}}}.
     476
     477As always, this behavior can be overridden on a per-model basis by specifying the {{{db_table}}} attribute in {{{class Meta}}} in your model.
     478
     479To 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.
    455480
    456481== Change subclassing syntax ==
Back to Top