equal
deleted
inserted
replaced
106 existing one, so the new cube schema is actually already in there). |
106 existing one, so the new cube schema is actually already in there). |
107 |
107 |
108 If some of the added cubes are already used by an instance, they'll simply be |
108 If some of the added cubes are already used by an instance, they'll simply be |
109 silently skipped. |
109 silently skipped. |
110 |
110 |
111 To remove a cube use `drop_cube(cube, removedeps=False)`. |
111 To remove a cube use `drop_cube(cube, removedeps=False)`. |
112 |
112 |
113 Schema migration |
113 Schema migration |
114 ---------------- |
114 ---------------- |
115 The following functions for schema migration are available in `repository` |
115 The following functions for schema migration are available in `repository` |
116 scripts: |
116 scripts: |
210 |
210 |
211 * `option_removed(option)`, indicates that an option has been deleted. |
211 * `option_removed(option)`, indicates that an option has been deleted. |
212 |
212 |
213 The `config` variable is an object which can be used to access the |
213 The `config` variable is an object which can be used to access the |
214 configuration values, for reading and updating, with a dictionary-like |
214 configuration values, for reading and updating, with a dictionary-like |
215 syntax. |
215 syntax. |
216 |
216 |
217 Example 1: migration script changing the variable 'sender-addr' in |
217 Example 1: migration script changing the variable 'sender-addr' in |
218 all-in-one.conf. The script also checks that in that the instance is |
218 all-in-one.conf. The script also checks that in that the instance is |
219 configured with a known value for that variable, and only updates the |
219 configured with a known value for that variable, and only updates the |
220 value in that case. |
220 value in that case. |
223 |
223 |
224 wrong_addr = 'cubicweb@loiglab.fr' # known wrong address |
224 wrong_addr = 'cubicweb@loiglab.fr' # known wrong address |
225 fixed_addr = 'cubicweb@logilab.fr' |
225 fixed_addr = 'cubicweb@logilab.fr' |
226 configured_addr = config.get('sender-addr') |
226 configured_addr = config.get('sender-addr') |
227 # check that the address has not been hand fixed by a sysadmin |
227 # check that the address has not been hand fixed by a sysadmin |
228 if configured_addr == wrong_addr: |
228 if configured_addr == wrong_addr: |
229 config['sender-addr'] = fixed-addr |
229 config['sender-addr'] = fixed-addr |
230 config.save() |
230 config.save() |
231 |
231 |
232 Example 2: checking the value of the database backend driver, which |
232 Example 2: checking the value of the database backend driver, which |
233 can be useful in case you need to issue backend-dependent raw SQL |
233 can be useful in case you need to issue backend-dependent raw SQL |