Przeglądaj źródła

Add doc on handling migrations when upgrading

Fixes #608
master
David Winterbottom 12 lat temu
rodzic
commit
2c8d8fb195
2 zmienionych plików z 53 dodań i 0 usunięć
  1. 1
    0
      docs/source/index.rst
  2. 52
    0
      docs/source/ref/upgrading.rst

+ 1
- 0
docs/source/index.rst Wyświetl plik

@@ -82,6 +82,7 @@ All you need to start developing apps with Oscar.
82 82
    ref/apps/index
83 83
    ref/settings
84 84
    ref/signals
85
+   ref/upgrading
85 86
 
86 87
 The Oscar open-source project
87 88
 -----------------------------

+ 52
- 0
docs/source/ref/upgrading.rst Wyświetl plik

@@ -0,0 +1,52 @@
1
+---------
2
+Upgrading
3
+---------
4
+
5
+This document explains some of the issues that can be encountered whilst
6
+upgrading Oscar.
7
+
8
+.. note::
9
+
10
+    Detailed upgrade instructions for specific releases can be found on the `Github
11
+    wiki`_.
12
+
13
+.. _`Github wiki`: https://github.com/tangentlabs/django-oscar/wiki/Upgrading
14
+
15
+Migrations
16
+----------
17
+
18
+Oscar uses South_ to provide migrations for its apps.  But since Oscar allows
19
+an app to be overridden and its models extended, handling migrations can be
20
+tricky when upgrading.  
21
+
22
+.. _South: http://south.readthedocs.org/en/latest/installation.html
23
+
24
+Suppose a new version of Oscar changes the models of the 'shipping' app and
25
+includes the corresponding migrations.  There are two scenarios to be aware of:
26
+
27
+Migrating uncustomised apps
28
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
29
+
30
+Apps that you aren't customising will upgrade trivially as your project
31
+will pick up the new migrations from Oscar directly.  
32
+
33
+For instance,  if you have ``oscar.apps.core.shipping`` in your
34
+``INSTALLED_APPS`` then you can simply run::
35
+
36
+    ./manage.py migrate shipping
37
+
38
+to migrate your shipping app.
39
+
40
+Migrating customised apps
41
+~~~~~~~~~~~~~~~~~~~~~~~~~
42
+
43
+For apps that you are customising, you need to create a new migration that picks
44
+up the changes in the core Oscar models::
45
+
46
+For instance,  if you have an app ``myproject.shipping`` that replaces
47
+``oscar.apps.shipping`` in your
48
+``INSTALLED_APPS`` then you can simply run::
49
+
50
+    ./manage.py schemamigration shipping --auto
51
+
52
+to create the appropriate migration.

Ładowanie…
Anuluj
Zapisz