Changes between Version 9 and Version 10 of GSOC2012/DatabaseMigration/Userguildlines

08/16/12 15:56:16 (12 years ago)



  • GSOC2012/DatabaseMigration/Userguildlines

    v9 v10  
    1313import migration_scripts
    1414import mapping_function
    15 migration_scripts.migrating_to_unique_field( web2py_path, app ,field_to_update , changed_table , list_of_tables, mapping_function)
     15migration_scripts.migrating_to_unique_field( web2py_path, app ,field_to_update , changed_table , list_of_tables)
    2222||field_to_update ||The name of the field with the unique and notnull property||
    2323||changed_table ||The name of the original table in which the new unique field id added||
    24 ||list_of_tables || These contains the list of tables which the changed_tables references ||
    25 ||mapping_function || Gives the mappings to load the new values in the unique field ||
     24||list_of_tables ||These contains the list of tables which the changed_tables references||
    2726=== migration_renaming_field ===
    2827==== Purpose of the migration====
     28Renaming a particular table , Thus if any fields point to that table that should be handled too.
    3030==== Method of Calling ====
    4646=== migration_renaming_table ===
    4747==== Purpose of the migration====
     48Renaming a particular field , while keeping the other properties of the field same. Also if there are some index on that table that should be recreated and other constraints should remain unchanged too.
    4950==== Method of Calling ====
    6364=== list_field_to_reference ===
    6465==== Purpose of the migration====
     66Some fields that have types like list:integer or list:reference or list:string.  These types encode multiple values into one string field.  What's in the field looks something like this: "|5|100|23|" -- it has values separated by vertical bars.  This is an official Web2py type, and typically Web2py handles packing and unpacking these fields:
     68Sometimes people find they need to pull those values out into a separate resource.  There are various reasons they might want to do this, e.g. they might find they need more than one item of information, so instead of a single value, which might be easy to pack into a list, they want instead to have a separate table in which they can have multiple columns, and join that to the original table.  To start with, they make a new table with a column for the values they'll get from the list field, and maybe some empty columns to be filled in later.  That new table has a foreign key reference back to the original table.  Then for each value in the list field for each record in the original table, they create one record in the new table that points back to the original record.
    6670==== Example of the migration ====