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. |
| 36 | PostgreSQL is different, because you have to rename sequences, too. To upgrade in PostgreSQL, execute this SQL in your database: |
| 37 | |
| 38 | {{{ |
| 39 | BEGIN; |
| 40 | |
| 41 | ALTER TABLE auth_groups RENAME TO auth_group; |
| 42 | ALTER TABLE auth_groups_id_seq RENAME TO auth_group_id_seq; |
| 43 | ALTER TABLE auth_group ALTER COLUMN id DROP DEFAULT; |
| 44 | ALTER TABLE auth_group ALTER COLUMN id SET DEFAULT nextval('public.auth_group_id_seq'::text); |
| 45 | |
| 46 | ALTER TABLE auth_groups_permissions RENAME TO auth_group_permissions; |
| 47 | ALTER TABLE auth_groups_permissions_id_seq RENAME TO auth_group_permissions_id_seq; |
| 48 | ALTER TABLE auth_group_permissions ALTER COLUMN id DROP DEFAULT; |
| 49 | ALTER TABLE auth_group_permissions ALTER COLUMN id SET DEFAULT nextval('public.auth_group_permissions_id_seq'::text); |
| 50 | |
| 51 | ALTER TABLE auth_messages RENAME TO auth_message; |
| 52 | ALTER TABLE auth_messages_id_seq RENAME TO auth_message_id_seq; |
| 53 | ALTER TABLE auth_message ALTER COLUMN id DROP DEFAULT; |
| 54 | ALTER TABLE auth_message ALTER COLUMN id SET DEFAULT nextval('public.auth_message_id_seq'::text); |
| 55 | |
| 56 | ALTER TABLE auth_permissions RENAME TO auth_permission; |
| 57 | ALTER TABLE auth_permissions_id_seq RENAME TO auth_permission_id_seq; |
| 58 | ALTER TABLE auth_permission ALTER COLUMN id DROP DEFAULT; |
| 59 | ALTER TABLE auth_permission ALTER COLUMN id SET DEFAULT nextval('public.auth_permission_id_seq'::text); |
| 60 | |
| 61 | ALTER TABLE auth_users RENAME TO auth_user; |
| 62 | ALTER TABLE auth_users_id_seq RENAME TO auth_user_id_seq; |
| 63 | ALTER TABLE auth_user ALTER COLUMN id DROP DEFAULT; |
| 64 | ALTER TABLE auth_user ALTER COLUMN id SET DEFAULT nextval('public.auth_user_id_seq'::text); |
| 65 | |
| 66 | ALTER TABLE auth_users_groups RENAME TO auth_user_groups; |
| 67 | ALTER TABLE auth_users_groups_id_seq RENAME TO auth_user_groups_id_seq; |
| 68 | ALTER TABLE auth_user_groups ALTER COLUMN id DROP DEFAULT; |
| 69 | ALTER TABLE auth_user_groups ALTER COLUMN id SET DEFAULT nextval('public.auth_user_groups_id_seq'::text); |
| 70 | |
| 71 | ALTER TABLE auth_users_user_permissions RENAME TO auth_user_user_permissions; |
| 72 | ALTER TABLE auth_users_user_permissions_id_seq RENAME TO auth_user_user_permissions_id_seq; |
| 73 | ALTER TABLE auth_user_user_permissions ALTER COLUMN id DROP DEFAULT; |
| 74 | ALTER TABLE auth_user_user_permissions ALTER COLUMN id SET DEFAULT nextval('public.auth_user_user_permissions_id_seq'::text); |
| 75 | |
| 76 | ALTER TABLE content_types RENAME TO django_content_type; |
| 77 | ALTER TABLE content_types_id_seq RENAME TO django_content_type_id_seq; |
| 78 | ALTER TABLE django_content_type ALTER COLUMN id DROP DEFAULT; |
| 79 | ALTER TABLE django_content_type ALTER COLUMN id SET DEFAULT nextval('public.django_content_type_id_seq'::text); |
| 80 | |
| 81 | ALTER TABLE core_sessions RENAME TO django_session; |
| 82 | |
| 83 | ALTER TABLE django_flatpages RENAME TO django_flatpage; |
| 84 | ALTER TABLE django_flatpages_id_seq RENAME TO django_flatpage_id_seq; |
| 85 | ALTER TABLE django_flatpage ALTER COLUMN id DROP DEFAULT; |
| 86 | ALTER TABLE django_flatpage ALTER COLUMN id SET DEFAULT nextval('public.django_flatpage_id_seq'::text); |
| 87 | |
| 88 | ALTER TABLE django_flatpages_sites RENAME TO django_flatpage_sites; |
| 89 | ALTER TABLE django_flatpages_sites_id_seq RENAME TO django_flatpage_sites_id_seq; |
| 90 | ALTER TABLE django_flatpage_sites ALTER COLUMN id DROP DEFAULT; |
| 91 | ALTER TABLE django_flatpage_sites ALTER COLUMN id SET DEFAULT nextval('public.django_flatpage_sites_id_seq'::text); |
| 92 | |
| 93 | ALTER TABLE django_redirects RENAME TO django_redirect; |
| 94 | ALTER TABLE django_redirects_id_seq RENAME TO django_redirect_id_seq; |
| 95 | ALTER TABLE django_redirect ALTER COLUMN id DROP DEFAULT; |
| 96 | ALTER TABLE django_redirect ALTER COLUMN id SET DEFAULT nextval('public.django_redirect_id_seq'::text); |
| 97 | |
| 98 | ALTER TABLE packages RENAME TO django_package; |
| 99 | |
| 100 | ALTER TABLE sites RENAME TO django_site; |
| 101 | ALTER TABLE sites_id_seq RENAME TO django_site_id_seq; |
| 102 | ALTER TABLE django_site ALTER COLUMN id DROP DEFAULT; |
| 103 | ALTER TABLE django_site ALTER COLUMN id SET DEFAULT nextval('public.django_site_id_seq'::text); |
| 104 | |
| 105 | COMMIT; |
| 106 | }}} |