Changeset 489:ee753e2661c1
- Timestamp:
- 01/23/10 15:53:22 (7 months ago)
- Author:
- rgrp <http://rufuspollock.org>
- Branch:
- default
- Message:
-
[migration][s]: fixes to existing revision_id and state migrations (they were really broken!!).
- Location:
- microfacts/migration/versions
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r482
|
r489
|
|
| 24 | 24 | dropped_fk_constraints = [] |
| 25 | 25 | revision_table = Table('revision', metadata, autoload=True) |
| 26 | | foreign_tables = ['factlet', 'thread', 'thread_factlet_table'] |
| | 26 | foreign_tables = ['factlet', 'factlet_revision', |
| | 27 | 'thread', 'thread_revision', |
| | 28 | 'thread_factlet_table', 'thread_factlet_table_revision'] |
| 27 | 29 | for table_name in foreign_tables: |
| 28 | 30 | table = Table(table_name, metadata, autoload=True) |
-
|
r484
|
r489
|
|
| 9 | 9 | def upgrade(): |
| 10 | 10 | stateful_tables = [ |
| 11 | | 'license', |
| 12 | 11 | 'thread', 'thread_revision', |
| 13 | 12 | 'factlet', 'factlet_revision', |
| 14 | | 'thread_factlet', 'thread_factlet_revision', |
| | 13 | 'thread_factlet_table', 'thread_factlet_table_revision', |
| 15 | 14 | 'revision' |
| 16 | 15 | ] |
| … |
… |
|
| 21 | 20 | column.create(table) |
| 22 | 21 | for (name,id) in [ ('active',1), ('deleted',2), ('pending',3) ]: |
| 23 | | sqlcmd = '''UPDATE %s SET state = %s WHERE state_id = %s''' % (table.name, name, id) |
| | 22 | sqlcmd = '''UPDATE %s SET state = '%s' WHERE state_id = %s''' % (table.name, name, id) |
| 24 | 23 | migrate_engine.execute(sqlcmd) |
| 25 | 24 | stateid = table.c['state_id'] |