# -*- ispell-local-dictionary: "english" -*- #+TITLE: Cyclos * Upgrade ** Migration of existing database This is taken into account on first run of the newer version. ** Cleaning an existing database to share a new version of it The initial dump provided should probably use: #+begin_src sql delete from account_balances; delete from dirty_account_balances; delete from closed_account_balances; delete from imported_file; delete from imported_files; delete from account_balances where account_id in (select id from accounts where user_id in (select id from users where status ='PURGED')); delete from user_status_logs where user_id in (select id from users where status = 'PURGED'); delete from messages_to_users where user_id in (select id from users where status = 'PURGED'); delete from ads where owner_id in (select id from users where status = 'PURGED'); delete from passwords where user_id in (select id from users where status = 'PURGED'); delete from user_group_logs where user_id in (select id from users where status = 'PURGED'); delete from admin_notif_settings_fwd_message_categories where preference_id in ( select id from notification_settings where user_id in ( select id from users where status = 'PURGED') ); delete from admin_notif_settings_user_groups where preference_id in ( select id from notification_settings where user_id in ( select id from users where status = 'PURGED') ); delete from notification_type_settings where settings_id in ( select id from notification_settings where user_id in ( select id from users where status = 'PURGED') ); delete from admin_notif_settings_user_alerts where admin_notification_preference_id in ( select id from notification_settings where user_id in ( select id from users where status = 'PURGED') ); delete from admin_notif_settings_external_payments_expired where preference_id in ( select id from notification_settings where user_id in ( select id from users where status = 'PURGED') ); delete from admin_notif_settings_external_payments_failed where preference_id in ( select id from notification_settings where user_id in ( select id from users where status = 'PURGED') ); delete from admin_notif_settings_payments where preference_id in ( select id from notification_settings where user_id in ( select id from users where status = 'PURGED') ); delete from notification_settings where user_id in (select id from users where status = 'PURGED'); delete from user_activities where user_id in (select id from users where status = 'PURGED'); delete from trusted_devices where user_id in (select id from users where status = 'PURGED'); delete from messages_to_groups where message_id in ( select id from messages where messages.owner_user_id in (select id from users where status = 'PURGED') or messages.sentby_user_id in (select id from users where status = 'PURGED')); delete from messages where owner_user_id in (select id from users where status = 'PURGED') or sentby_user_id in (select id from users where status = 'PURGED'); delete from notifications where user_id in (select id from users where status = 'PURGED'); delete from failed_action_logs where user_id in (select id from users where status = 'PURGED'); delete from users where status = 'PURGED'; delete from ad_history_logs; delete from notified_ad_interests; delete from alerts; delete from error_logs; delete from entity_property_logs; delete from entity_logs; delete from login_history_logs; delete from messages; delete from failed_action_logs; #+end_src This will set back admin password to 1234 as stated in [[https://documentation.cyclos.org/4.14/cyclos-reference/installation-maintenance.html][cyclos maintenance documentation]] #+begin_src sql UPDATE passwords SET value='$2a$10$yM.uw9jC7C1DrRGUhqUc3eSR6FCJH0.HdDt3CJs8YL56iATHcXH7.' WHERE user_id = (SELECT id FROM users WHERE username='admin') AND status = 'ACTIVE' AND password_type_id in ( SELECT id FROM password_types WHERE input_method = 'TEXT_BOX' AND password_mode = 'MANUAL' ); UPDATE passwords SET value = '$2a$04$rDPKseEiJhYdjx9RogW2tuzNX4TKG1wcE79ooEXiA5.mJF.ooZY/2' WHERE status <> 'OLD' AND password_type_id in ( SELECT id FROM password_types WHERE input_method = 'TEXT_BOX' AND password_mode = 'MANUAL' ); UPDATE users SET email = concat(username, '@test.com') WHERE email IS NOT null; #+end_src This needs to be deleted also for any dumps. #+begin_src sql delete from database_lock; #+end_src In java also: #+begin_src sh compose --debug stop cyclos compose --debug --no-hooks run --entrypoint bash cyclos #+end_src then inside the docker: #+begin_src sh java -cp "WEB-INF/classes:WEB-INF/lib/*:/usr/local/tomcat/lib/*" \ org.cyclos.db.DeleteNetworkData #+end_src (remove all users and transfer, choice 1, then 'yes') * Changing Licence information This command is to be executed from the host, knowing that here =cyclos= stands for the name of the =cyclos= service: #+begin_src sh compose sql cyclos <