Skip to content

Instantly share code, notes, and snippets.

@mxamin
Last active September 16, 2018 12:03
Show Gist options
  • Save mxamin/5079ad8ef8245afcfb1a544fcd7e57b4 to your computer and use it in GitHub Desktop.
Save mxamin/5079ad8ef8245afcfb1a544fcd7e57b4 to your computer and use it in GitHub Desktop.

TCI Migration (Tabriz)

We want to move data of following tables from one server (A: Tabriz) to another server (B: TCI).

User tables:

  • users
  • user_attrs
  • normal_users

Group tables:

  • groups
  • group_attrs

Charge tables:

  • charges
  • charge_rules
  • charge_rule_attrs

Custom Field table:

  • user_custom_field

Notification tables:

  • notification_profile
  • notification_rule

Step 1 (Server A)

Export tables data from server A as CSV files and import them into server B.

Create a directory in /tmp/ to save our export files:

# rm -rf /tmp/migration_A/
# mkdir /tmp/migration_A/
# chmod 777 /tmp/migration_A/

Export User tables data:

IBSng=# COPY (SELECT user_id, isp_id, credit, deposit, deposit_recharge, status, group_id, creation_date, nearest_exp_date FROM users) TO '/tmp/migration_A/migration_A_users.csv' WITH DELIMITER ',';

IBSng=# COPY (SELECT user_id, attr_name, attr_value FROM user_attrs) TO '/tmp/migration_A/migration_A_user_attrs.csv' WITH DELIMITER ',';

IBSng=# COPY (SELECT user_id, normal_username, normal_password, second_normal_username FROM normal_users) TO '/tmp/migration_A/migration_A_normal_users.csv' WITH DELIMITER ',';

Export Group tables data:

IBSng=# COPY (SELECT group_id, group_name, status, isp_id, comment FROM groups) TO '/tmp/migration_A/migration_A_groups.csv' WITH DELIMITER ',';

IBSng=# COPY (SELECT group_id, attr_name, attr_value FROM group_attrs) TO '/tmp/migration_A/migration_A_group_attrs.csv' WITH DELIMITER ',';

Export Charge tables data:

IBSng=# COPY (SELECT charge_id, charge_name, comment, isp_id FROM charges) TO '/tmp/migration_A/migration_A_charges.csv' WITH DELIMITER ',';

IBSng=# COPY (SELECT charge_rule_id, charge_rule_description, charge_rule_priority, charge_id FROM charge_rules) TO '/tmp/migration_A/migration_A_charge_rules.csv' WITH DELIMITER ',';

IBSng=# COPY (SELECT charge_rule_id, attr_name, attr_value FROM charge_rule_attrs) TO '/tmp/migration_A/migration_A_charge_rule_attrs.csv' WITH DELIMITER ',';

Export Custom Field table data:

IBSng=# COPY (SELECT custom_field_id, custom_field_name, custom_field_description, custom_field_comment, custom_field_value_type, custom_field_interface_type, custom_field_mandatory FROM user_custom_field) TO '/tmp/migration_A/migration_A_user_custom_field.csv' WITH DELIMITER ',';

Export Notification tables data:

IBSng=# COPY (SELECT notification_profile_id, notification_profile_name, notification_profile_comment, isp_id FROM notification_profile) TO '/tmp/migration_A/migration_A_notification_profile.csv' WITH DELIMITER ',';

IBSng=# COPY (SELECT notification_rule_id, notification_profile_id, notification_type, notification_threshold, message_type, message_template FROM notification_rule) TO '/tmp/migration_A/migration_A_notification_rule.csv' WITH DELIMITER ',';

Now that we have exported data from the database, we need to move them to server B:

# cd /tmp/
# tar zcf migration_A.tar.gz migration_A
# rm -rf migration_A

Now we need to move the file /tmp/migration_A.tar.gz to server B by SCP, FTP, etc.

Step 2 (Server B)

Suppose we moved exported data files which was generated in step 1 to /tmp/ directory, now we need to extract them:

# cd /tmp/
# rm -rf migration_A
# tar xf migration_A.tar.gz
# rm -rf migration_A.tar.gz

Step 2.1

Now we need to create temporary tables and fill them with exported data from server A.

Create temporary User tables:

IBSng=# CREATE TABLE migration_A_users AS SELECT user_id, isp_id, credit, deposit, deposit_recharge, status, group_id, creation_date, nearest_exp_date FROM users LIMIT 1;
IBSng=# TRUNCATE migration_A_users;

IBSng=# CREATE TABLE migration_A_user_attrs AS SELECT user_id, attr_name, attr_value FROM user_attrs LIMIT 1;
IBSng=# TRUNCATE migration_A_user_attrs;

IBSng=# CREATE TABLE migration_A_normal_users AS SELECT user_id, normal_username, normal_password, second_normal_username FROM normal_users LIMIT 1;
IBSng=# TRUNCATE migration_A_normal_users;

Create temporary Group tables:

IBSng=# CREATE TABLE migration_A_groups AS SELECT group_id, group_name, status, isp_id, comment FROM groups LIMIT 1;
IBSng=# TRUNCATE migration_A_groups;

IBSng=# CREATE TABLE migration_A_group_attrs AS SELECT group_id, attr_name, attr_value FROM group_attrs LIMIT 1;
IBSng=# TRUNCATE migration_A_group_attrs;

Create temporary Charge tables:

IBSng=# CREATE TABLE migration_A_charges AS SELECT charge_id, charge_name, comment, isp_id  FROM charges LIMIT 1;
IBSng=# TRUNCATE migration_A_charges;

IBSng=# CREATE TABLE migration_A_charge_rules AS SELECT charge_rule_id, charge_rule_description, charge_rule_priority, charge_id FROM charge_rules LIMIT 1;
IBSng=# TRUNCATE migration_A_charge_rules;

IBSng=# CREATE TABLE migration_A_charge_rule_attrs AS SELECT charge_rule_id, attr_name, attr_value FROM charge_rule_attrs LIMIT 1;
IBSng=# TRUNCATE migration_A_charge_rule_attrs;

Create temporary Custom Field table:

IBSng=# CREATE TABLE migration_A_user_custom_field AS SELECT custom_field_id, custom_field_name, custom_field_description, custom_field_comment, custom_field_value_type, custom_field_interface_type, custom_field_mandatory FROM user_custom_field LIMIT 1;
IBSng=# TRUNCATE migration_A_user_custom_field;

Create temporary Notification tables:

IBSng=# CREATE TABLE migration_A_notification_profile AS SELECT notification_profile_id, notification_profile_name, notification_profile_comment, isp_id FROM notification_profile LIMIT 1;
IBSng=# TRUNCATE migration_A_notification_profile;

IBSng=# CREATE TABLE migration_A_notification_rule AS SELECT notification_rule_id, notification_profile_id, notification_type, notification_threshold, message_type, message_template FROM notification_rule LIMIT 1;
IBSng=# TRUNCATE migration_A_notification_rule;

Step 2.2

Import data from CSV files of server A to temporary tables we just created;

Import User tables data:

IBSng=# COPY migration_A_users (user_id, isp_id, credit, deposit, deposit_recharge, status, group_id, creation_date, nearest_exp_date) FROM '/tmp/migration_A/migration_A_users.csv' WITH DELIMITER ',';

IBSng=# COPY migration_A_user_attrs (user_id, attr_name, attr_value) FROM '/tmp/migration_A/migration_A_user_attrs.csv' WITH DELIMITER ',';

IBSng=# COPY migration_A_normal_users (user_id, normal_username, normal_password, second_normal_username) FROM '/tmp/migration_A/migration_A_normal_users.csv' WITH DELIMITER ',';

Import Group tables data:

IBSng=# COPY migration_A_groups (group_id, group_name, status, isp_id, comment) FROM '/tmp/migration_A/migration_A_groups.csv' WITH DELIMITER ',';

IBSng=# COPY migration_A_group_attrs (group_id, attr_name, attr_value) FROM '/tmp/migration_A/migration_A_group_attrs.csv' WITH DELIMITER ',';

Import Charge tables data:

IBSng=# COPY migration_A_charges (charge_id, charge_name, comment, isp_id) FROM '/tmp/migration_A/migration_A_charges.csv' WITH DELIMITER ',';

IBSng=# COPY migration_A_charge_rules (charge_rule_id, charge_rule_description, charge_rule_priority, charge_id) FROM '/tmp/migration_A/migration_A_charge_rules.csv' WITH DELIMITER ',';

IBSng=# COPY migration_A_charge_rule_attrs (charge_rule_id, attr_name, attr_value) FROM '/tmp/migration_A/migration_A_charge_rule_attrs.csv' WITH DELIMITER ',';

Import Custom Field table data:

IBSng=# COPY migration_A_user_custom_field (custom_field_id, custom_field_name, custom_field_description, custom_field_comment, custom_field_value_type, custom_field_interface_type, custom_field_mandatory) FROM '/tmp/migration_A/migration_A_user_custom_field.csv' WITH DELIMITER ',';

Import Notification tables data:

IBSng=# COPY migration_A_notification_profile (notification_profile_id, notification_profile_name, notification_profile_comment, isp_id) FROM '/tmp/migration_A/migration_A_notification_profile.csv' WITH DELIMITER ',';

IBSng=# COPY migration_A_notification_rule (notification_rule_id, notification_profile_id, notification_type, notification_threshold, message_type, message_template) FROM '/tmp/migration_A/migration_A_notification_rule.csv' WITH DELIMITER ',';

Step 2.3

To make column ids of temporary tables compatible with server B, we create a new column named <id_column>_new and rename the current column name to <id_column>_old; then we fill <id_column>_new with corresponded values.

Add/Rename User tables ID columns:

IBSng=# ALTER TABLE migration_A_users RENAME COLUMN user_id TO user_id_old;
IBSng=# ALTER TABLE migration_A_users RENAME COLUMN group_id TO group_id_old;
IBSng=# ALTER TABLE migration_A_users ADD COLUMN user_id_new bigint;
IBSng=# ALTER TABLE migration_A_users ADD COLUMN group_id_new bigint;

IBSng=# ALTER TABLE migration_A_user_attrs RENAME COLUMN user_id TO user_id_old;
IBSng=# ALTER TABLE migration_A_user_attrs ADD COLUMN user_id_new bigint;

IBSng=# ALTER TABLE migration_A_normal_users RENAME COLUMN user_id TO user_id_old;
IBSng=# ALTER TABLE migration_A_normal_users ADD COLUMN user_id_new bigint;

Add/Rename Group tables ID columns:

IBSng=# ALTER TABLE migration_A_groups RENAME COLUMN group_id TO group_id_old;
IBSng=# ALTER TABLE migration_A_groups ADD COLUMN group_id_new bigint;

IBSng=# ALTER TABLE migration_A_group_attrs RENAME COLUMN group_id TO group_id_old;
IBSng=# ALTER TABLE migration_A_group_attrs ADD COLUMN group_id_new bigint;

Add/Rename Charge tables ID columns:

IBSng=# ALTER TABLE migration_A_charges RENAME COLUMN charge_id TO charge_id_old;
IBSng=# ALTER TABLE migration_A_charges ADD COLUMN charge_id_new bigint;

IBSng=# ALTER TABLE migration_A_charge_rules RENAME COLUMN charge_rule_id TO charge_rule_id_old;
IBSng=# ALTER TABLE migration_A_charge_rules RENAME COLUMN charge_id TO charge_id_old;
IBSng=# ALTER TABLE migration_A_charge_rules ADD COLUMN charge_rule_id_new bigint;
IBSng=# ALTER TABLE migration_A_charge_rules ADD COLUMN charge_id_new bigint;

IBSng=# ALTER TABLE migration_A_charge_rule_attrs RENAME COLUMN charge_rule_id TO charge_rule_id_old;
IBSng=# ALTER TABLE migration_A_charge_rule_attrs ADD COLUMN charge_rule_id_new bigint;

Add/Rename Custom Field table ID columns:

IBSng=# ALTER TABLE migration_A_user_custom_field RENAME COLUMN custom_field_id TO custom_field_id_old;
IBSng=# ALTER TABLE migration_A_user_custom_field ADD COLUMN custom_field_id_new bigint;

Add/Rename Notification tables ID columns:

IBSng=# ALTER TABLE migration_A_notification_profile RENAME COLUMN notification_profile_id TO notification_profile_id_old;
IBSng=# ALTER TABLE migration_A_notification_profile ADD COLUMN notification_profile_id_new bigint;

IBSng=# ALTER TABLE migration_A_notification_rule RENAME COLUMN notification_rule_id TO notification_rule_id_old;
IBSng=# ALTER TABLE migration_A_notification_rule RENAME COLUMN notification_profile_id TO notification_profile_id_old;
IBSng=# ALTER TABLE migration_A_notification_rule ADD COLUMN notification_rule_id_new bigint;
IBSng=# ALTER TABLE migration_A_notification_rule ADD COLUMN notification_profile_id_new bigint;

Step 2.4

Fill temporary tables with new IDs.

Generate new IDs for User table:

IBSng=# UPDATE migration_A_users SET user_id_new = nextval('users_user_id_seq');

Generate new IDs for Group table:

IBSng=# UPDATE migration_A_groups SET group_id_new = nextval('groups_group_id_seq');

Generate new IDs for Charge tables:

IBSng=# UPDATE migration_A_charges SET charge_id_new = nextval('charges_charge_id_seq');

IBSng=# UPDATE migration_A_charge_rules SET charge_rule_id_new = nextval('charge_rules_charge_rule_id_seq');

Generate new IDs for Custom Field table:

IBSng=# UPDATE migration_A_user_custom_field SET custom_field_id_new = nextval('user_custom_field_custom_field_id');

Generate new IDs for Notification tables:

IBSng=# UPDATE migration_A_notification_profile SET notification_profile_id_new = nextval('notification_profile_id_seq');

IBSng=# UPDATE migration_A_notification_rule SET notification_rule_id_new = nextval('notification_rule_id_seq');

Step 2.5

Map old IDs to new IDs and fill corresponded values in temporary tables.

Map User tables old IDs to new IDs:

IBSng=# UPDATE migration_A_users SET group_id_new = migration_A_groups.group_id_new FROM migration_A_groups WHERE migration_A_users.group_id_old = migration_A_groups.group_id_old;

IBSng=# UPDATE migration_A_user_attrs SET user_id_new = migration_A_users.user_id_new FROM migration_A_users WHERE migration_A_user_attrs.user_id_old = migration_A_users.user_id_old;

IBSng=# UPDATE migration_A_normal_users SET user_id_new = migration_A_users.user_id_new FROM migration_A_users WHERE migration_A_normal_users.user_id_old = migration_A_users.user_id_old;

Map Group tables old IDs to new IDs:

IBSng=# UPDATE migration_A_group_attrs SET group_id_new = migration_A_groups.group_id_new FROM migration_A_groups WHERE migration_A_group_attrs.group_id_old = migration_A_groups.group_id_old;

Map Charge tables old IDs to new IDs:

IBSng=# UPDATE migration_A_charge_rules SET charge_id_new = migration_A_charges.charge_id_new FROM migration_A_charges WHERE migration_A_charge_rules.charge_id_old = migration_A_charges.charge_id_old;

IBSng=# UPDATE migration_A_charge_rule_attrs SET charge_rule_id_new = migration_A_charge_rules.charge_rule_id_new FROM migration_A_charge_rules WHERE migration_A_charge_rule_attrs.charge_rule_id_old = migration_A_charge_rules.charge_rule_id_old;

Map Notification table old IDs to new IDs:

IBSng=# UPDATE migration_A_notification_rule SET notification_profile_id_new = migration_A_notification_profile.notification_profile_id_new FROM migration_A_notification_profile WHERE migration_A_notification_rule.notification_profile_id_old = migration_A_notification_profile.notification_profile_id_old;

Step 3

Update isp_id of records:

IBSng=# UPDATE migration_A_users SET isp_id = <province_isp_id>;
IBSng=# UPDATE migration_A_groups SET isp_id = <crm_isp_id>;
IBSng=# UPDATE migration_A_charges SET isp_id = <crm_isp_id>;
IBSng=# UPDATE migration_A_notification_profile SET isp_id = <crm_isp_id>;

Note: As you can see, we use different isp_id for different tables.

Step 4

Delete users from temporary tables with the same normal_username in server B:

IBSng=# CREATE TABLE migration_A_users_dup AS SELECT user_id_old as user_id_dup FROM migration_A_normal_users WHERE normal_username IN (SELECT normal_username FROM normal_users);

IBSng=# DELETE FROM migration_A_users WHERE user_id_old IN (SELECT user_id_dup FROM migration_A_users_dup);

IBSng=# DELETE FROM migration_A_user_attrs WHERE user_id_old IN (SELECT user_id_dup FROM migration_A_users_dup);

IBSng=# DELETE FROM migration_A_normal_users WHERE user_id_old IN (SELECT user_id_dup FROM migration_A_users_dup);

IBSng=# DROP TABLE migration_A_users_dup;

Step 5

Change temporary tables value according to requirements and fix attributes according to new values.

Step 5.1

Add prepend TCI_Shaskam_ to:

  • groups: group_name
  • charges: charge_name
  • user_custom_field: custom_field_name
  • notification_profile: notification_profile_name
IBSng=# UPDATE migration_a_groups SET group_name = CONCAT('TCI_Shaskam_', group_name);

IBSng=# UPDATE migration_a_charges SET charge_name = CONCAT('TCI_Shaskam_', charge_name);

IBSng=# UPDATE migration_a_user_custom_field SET custom_field_name = CONCAT('TCI_Shaskam_', custom_field_name);

IBSng=# UPDATE migration_a_notification_profile SET notification_profile_name = CONCAT('TCI_Shakam_', notification_profile_name);

Step 5.2

Update users and groups attributes with new custom field names (previous step):

IBSng=# UPDATE migration_a_user_attrs SET attr_name = CONCAT('custom_field_TCI_Shaskam_', substring(attr_name from 14)) WHERE attr_name LIKE 'custom_field_%';

IBSng=# UPDATE migration_a_group_attrs SET attr_name = CONCAT('custom_field_TCI_Shaskam_', substring(attr_name from 14)) WHERE attr_name LIKE 'custom_field_%';

Step 5.3

Update users and groups attributes with new charge and notificaton profile IDs:

IBSng=# UPDATE migration_a_user_attrs SET attr_value = migration_a_charges.charge_id_new FROM migration_a_charges WHERE migration_a_user_attrs.attr_name = 'charge' AND  migration_a_user_attrs.attr_value = CAST (migration_a_charges.charge_id_old AS text);

IBSng=# UPDATE migration_a_group_attrs SET attr_value = migration_a_charges.charge_id_new FROM migration_a_charges WHERE migration_a_group_attrs.attr_name = 'charge' AND  migration_a_group_attrs.attr_value = CAST (migration_a_charges.charge_id_old AS text);

IBSng=# UPDATE migration_a_group_attrs SET attr_value = migration_a_notification_profile.notification_profile_id_new FROM migration_a_notification_profile WHERE migration_a_group_attrs.attr_name = 'notification_profile' AND  migration_a_group_attrs.attr_value = CAST (migration_a_notification_profile.notification_profile_id_old AS text);

Step 5.4

Update charge_rule_usages attribute of users with new Charge Rule IDs.

Move migration_update_charge_rule_usages.py file to /opt/ directory and run it:

# cd /opt/
# python migration_update_charge_rule_usages.py

Step 5.5

Some minor cleanup:

IBSng=# DELETE FROM migration_a_user_attrs WHERE attr_name = 'charge_rule_details';
IBSng=# DELETE FROM migration_a_user_attrs WHERE attr_name = 'ippool';

IBSng=# DELETE FROM migration_a_group_attrs WHERE attr_name = 'limit_ras';
IBSng=# DELETE FROM migration_a_group_attrs WHERE attr_name = 'ippool';

IBSng=# DELETE FROM migration_a_charge_rule_attrs WHERE attr_name = 'ras';
IBSng=# DELETE FROM migration_a_charge_rule_attrs WHERE attr_name = 'ippool';

Step 6

TODO: Backup from the database and especially a separate backup from tables which are going to be changed.

Step 6.1

Insert temporary tables records into main tables.

Insert Notification table records:

IBSng=# INSERT INTO notification_profile (notification_profile_id, notification_profile_name, notification_profile_comment, isp_id) SELECT notification_profile_id_new, notification_profile_name, notification_profile_comment, isp_id FROM migration_a_notification_profile;

IBSng=# INSERT INTO notification_rule (notification_rule_id, notification_profile_id, notification_type, notification_threshold, message_type, message_template) SELECT notification_rule_id_new, notification_profile_id_new, notification_type, notification_threshold, message_type, message_template FROM migration_a_notification_rule;

Insert Custom Field table records:

IBSng=# INSERT INTO user_custom_field (custom_field_id, custom_field_name, custom_field_description, custom_field_comment, custom_field_value_type, custom_field_interface_type, custom_field_mandatory) SELECT custom_field_id_new, custom_field_name, custom_field_description, custom_field_comment, custom_field_value_type, custom_field_interface_type, custom_field_mandatory FROM migration_a_user_custom_field;

Insert Charge tables records:

IBSng=# INSERT INTO charges (charge_id, charge_name, comment, isp_id) SELECT charge_id_new, charge_name, comment, isp_id FROM migration_a_charges;

IBSng=# INSERT INTO charge_rules (charge_rule_id, charge_rule_description, charge_rule_priority, charge_id) SELECT charge_rule_id_new, charge_rule_description, charge_rule_priority, charge_id_new FROM migration_a_charge_rules;

IBSng=# INSERT INTO charge_rule_attrs (charge_rule_id, attr_name, attr_value) SELECT charge_rule_id_new, attr_name, attr_value FROM migration_a_charge_rule_attrs;

Insert Group tables records:

IBSng=# INSERT INTO groups (group_id, group_name, status, isp_id, comment) SELECT group_id_new, group_name, status, isp_id, comment FROM migration_a_groups;

IBSng=# INSERT INTO group_attrs (group_id, attr_name, attr_value) SELECT group_id_new, attr_name, attr_value FROM migration_a_group_attrs;

Insert User tables records:

IBSng=# INSERT INTO users (user_id, isp_id, credit, deposit, deposit_recharge, status, group_id, creation_date, nearest_exp_date) SELECT user_id_new, isp_id, credit, deposit, deposit_recharge, status, group_id_new, creation_date, nearest_exp_date FROM migration_a_users;

IBSng=# ALTER TABLE user_attrs DISABLE TRIGGER update_user_nearest_exp_date_trigger;
IBSng=# INSERT INTO user_attrs (user_id, attr_name, attr_value) SELECT user_id_new, attr_name, attr_value FROM migration_a_user_attrs;
IBSng=# ALTER TABLE user_attrs ENABLE TRIGGER update_user_nearest_exp_date_trigger;

IBSng=# ALTER TABLE normal_users DISABLE TRIGGER users_prevent_duplicate_username_trigger;
IBSng=# INSERT INTO normal_users (user_id, normal_username, normal_password, second_normal_username) SELECT user_id_new, normal_username, normal_password, second_normal_username FROM migration_a_normal_users;
IBSng=# ALTER TABLE normal_users ENABLE TRIGGER users_prevent_duplicate_username_trigger;

Note: In inserting records to normal_users table, remember to disable the trigger of the table; otherwise it takes a very long time to insert records.

Step 7

Now that we completed the migration, we need to reload users, groups, charges, user_custom_fields and notifications.

Step 7.1

Export IDs of new users, groups, charges, user_custom_fields and notifications.

Export User IDs:

IBSng=# COPY (SELECT user_id_new FROM migration_A_users) TO '/tmp/migration_A/migration_A_users_reload.csv' WITH DELIMITER ',';

Export Group IDs:

IBSng=# COPY (SELECT group_id_new FROM migration_A_groups) TO '/tmp/migration_A/migration_A_groups_reload.csv' WITH DELIMITER ',';

Export Charge IDs:

IBSng=# COPY (SELECT charge_id_new FROM migration_A_charges) TO '/tmp/migration_A/migration_A_charges_reload.csv' WITH DELIMITER ',';

Export Custom Field IDs:

IBSng=# COPY (SELECT custom_field_id_new FROM migration_A_user_custom_field) TO '/tmp/migration_A/migration_A_user_custom_field_reload.csv' WITH DELIMITER ',';

Export Notification IDs:

IBSng=# COPY (SELECT notification_profile_id_new FROM migration_a_notification_profile) TO '/tmp/migration_A/migration_A_notification_profile_reload.csv' WITH DELIMITER ',';

Step 7.2

Run reload script for new users, groups, charges, user_custom_fields and notifications. These scripts should be run on master App of IBSng.

TODO: create reload scripts

Move migration_scripts.tar.gz to /opt/ and extract them:

# cd /opt/
# tar xf migration_scripts.tar.gz

Run User reload script:

# python /usr/local/IBSng/addons/client/client.py -u <web_panel_username> -p <web_panel_password> -i /opt/migration_scripts/reload_users_by_csv.py

Run User reload script:

# python /usr/local/IBSng/addons/client/client.py -u <web_panel_username> -p <web_panel_password> -i /opt/migration_scripts/reload_users_by_csv.py

Run Group reload script:

# python /usr/local/IBSng/addons/client/client.py -u <web_panel_username> -p <web_panel_password> -i /opt/migration_scripts/reload_groups_by_csv.py

Run Charge reload script:

# python /usr/local/IBSng/addons/client/client.py -u <web_panel_username> -p <web_panel_password> -i /opt/migration_scripts/reload_charges_by_csv.py

Run Custom Field reload script:

# python /usr/local/IBSng/addons/client/client.py -u <web_panel_username> -p <web_panel_password> -i /opt/migration_scripts/reload_user_custom_field_by_csv.py

Run Notification reload script:

# python /usr/local/IBSng/addons/client/client.py -u <web_panel_username> -p <web_panel_password> -i /opt/migration_scripts/reload_notification_by_csv.py

Notes

TODO: Creat mapping files of migrated data for third party applications, (user_id_old, user_id_new), (group_name_old, group_name_new)

TODO: Keep psycopg2 file in hand in case you don't have access to internet (psycopg2 is required for update charge rule usages script).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment