Changes between Version 4 and Version 5 of UserGuidelines/Admin/DataMigration/Haiti


Ignore:
Timestamp:
01/17/10 12:22:19 (12 years ago)
Author:
Fran Boon
Comment:

Live migrations

Legend:

Unmodified
Added
Removed
Modified
  • UserGuidelines/Admin/DataMigration/Haiti

    v4 v5  
    2424}}}
    2525
     26==== Changing a Column type in Sqlite live ====
     27sqlite handles live migrations pretty well, however if there is existing data then a conversion from string to integer can cause problems.
     28For a development system, the easiest solution is simply to remove all {{{databases/*}}} & restart, however this isn't possible for a live system:
     29{{{
     30vim /home/haiti/prod/models/00_db.py
     31    migrate = True
     32
     33cd /home/haiti/prod
     34bzr pull
     35
     36cd /home/haiti/web2py
     37python web2py.py -S prod -M
     38
     39db(db.or_organisation.id > 0).select().export_to_csv_file(open('orgs.csv','wb'))
     40db.or_organisation.drop()
     41db.commit()
     42Ctrl+D
     43
     44python web2py.py -S prod -M
     45
     46db.or_organisation.import_from_csv_file(open('orgs.csv','rb'))
     47db.commit()
     48Ctrl+D
     49
     50/etc/init.d/apache2 force-reload
     51
     52vim /home/haiti/prod/models/00_db.py
     53    migrate = False
     54
     55}}}
    2656=== Web Services ===
    2757Better to avoid locks & do without SSH login