wiki:GSOC2012/DatabaseMigration/Userguildlines

Version 7 (modified by anubhav, 12 years ago) ( diff )

--

Comparson script

Migration Script

All the functions that does the migration have been added to migration_scripts file . migration_scripts file internally calls the functions of migration_helping_methods file too perform the migration . Thus in order to do the migration one just needs to import migration_scripts and call the method corresponding to the migration he wants . Also the user who wishes to do the migration in the db doesn't have to know the internal functioning of migration_script , thus the functions or the methods declared in migration_helping_methods file doesn't concern him.

Methods in migration_scripts file

migrating_to_unique_field

Purpose of the migration

Method of Calling

import migration_scripts
migration_scripts.migrating_to_unique_field(web2py_path,app,field_to_update,changed_table,list_of_tables_for_query)

Description of arguments

Argument Description
web2py_path The path to the web2py congaing the Eden app (i.e "/home/web2py")
app The name of the eden application of whose database needs to be migrated (i.e "eden")
field_to_update The name of the new table to which the list field needs to migrated
changed_table The name of the original table
list_of_tables_for_querylist_of_tables_for_query

migration_renaming_field

Purpose of the migration

Method of Calling

import migration_scripts
migration_scripts.migration_renaming_field(web2py_path, app, old_table, old_field_name , new_field_name ,attributes_to_copy)

Description of arguments

Argument Description
web2py_path The path to the web2py congaing the Eden app (i.e "/home/web2py")
app The name of the eden application of whose database needs to be migrated (i.e "eden")
old_table The name of the original table
old_field_name The name of the field in the new table which will hold the content of the list field
new_field_name The name of the list field in the original table
attributes_to_copy The name of the id field in the original table

migration_renaming_table

Purpose of the migration

Method of Calling

import migration_scripts
migration_scripts.migration_renaming_table(web2py_path, app ,old_table_name,new_table_name)

Description of arguments

Argument Description
web2py_path The path to the web2py congaing the Eden app (i.e "/home/web2py")
app The name of the eden application of whose database needs to be migrated (i.e "eden")
new_table_name The name of the new table to which the list field needs to migrated
old_table_name The name of the original table

list_field_to_reference

Purpose of the migration

Example of the migration

http://pastebin.ubuntu.com/1142568/

Method of Calling

import migration_scripts
migration_scripts.list_field_to_reference(web2py_path,app,new_table_name , new_list_field , list_field_name , old_table_id_field , old_table)

Description of arguments

Argument Description
web2py_path The path to the web2py congaing the Eden app (i.e "/home/web2py")
app The name of the eden application of whose database needs to be migrated (i.e "eden")
new_table_name The name of the new table to which the list field needs to migrated
new_list_field The name of the field in the new table which will hold the content of the list field
list_field_name The name of the list field in the original table
old_table_id_field The name of the id field in the original table
old_table The name of the original table
Note: See TracWiki for help on using the wiki.