| 1 | == Data Migration == |
| 2 | |
| 3 | * CSV (beware DB locks!) |
| 4 | {{{ |
| 5 | python web2py.py -S prod -M |
| 6 | db.export_to_csv_file(open('db.csv','wb')) |
| 7 | Ctrl+D |
| 8 | }}} |
| 9 | Remove reference Tables from CSV file (don't want to import duplicates!) |
| 10 | {{{ |
| 11 | python web2py.py -S dev -M |
| 12 | db.import_from_csv_file(open('db.csv','rb')) |
| 13 | db.commit() |
| 14 | Ctrl+D |
| 15 | }}} |
| 16 | * Web services (better to avoid locks) |
| 17 | * Currently needs to be done resource by resource (JOINed tables can be done together as Components of main resource) |
| 18 | * need to do referenced tables before the tables which refer to them |
| 19 | * migrate the locations first (using the xml interface), you can later migrate the orgs and offices together (through Component JOIN) |
| 20 | * Ideally we want to develop a way of having all tables loaded together into RAM, refs fixed-up & then imported to db together |
| 21 | |