Copy Configuration without current data

Any issue about installation and configuration of the Cyclos 4 version

Moderators: hugo, alexandre, rmvanarkel

Post Reply
trustpay
Posts: 70
Joined: Mon Aug 03, 2015 10:19 am

Copy Configuration without current data

Post by trustpay »

I have a problem need your support.
Now we want to move system from test DB to production DB. So, I want to copy all configurations without current data (like transactions, balance, users....), do you have any way to do that? If cannot, do you have any way to delete current data but still keep all configurations?

Thanks

rmvanarkel
Posts: 244
Joined: Tue Oct 05, 2010 1:14 pm

Re: Copy Configuration without current data

Post by rmvanarkel »

Dear Trustpay,

There are two ways to do this:

1) In most cases we would recommend to just start over and manually copy the products, configurations, accounts and transaction types, field etc you created. For most people this is the best solution.

2) Only for very advanced users that know a lot about database and are willing to test thoroughly if removing the users worked correctly for you specific configuration we have this script. Please be aware we supply this database script without any warranty, you can use it at your own risk. Also this script only works for Cyclos 4.8.2. The script should remove all regular / broker users (leaving only the admins) and all data they have, including transactions. Of course, please, make sure you test it first in a backup.

The file can be found here:
https://drive.google.com/file/d/0BycgIe ... sp=sharing

Good luck!

trustpay
Posts: 70
Joined: Mon Aug 03, 2015 10:19 am

Re: Copy Configuration without current data

Post by trustpay »

Dear,

When running your scripts, it shows error as below:
<My account>=# delete from vouchers;
ERROR: update or delete on table "vouchers" violates foreign key constraint "fk_amount_reservations_voucher_id" on table "amount_reservations"
DETAIL: Key (id)=(5) is still referenced from table "amount_reservations".
<My account>=# delete from voucher_packs;
ERROR: update or delete on table "voucher_packs" violates foreign key constraint "fk_amount_reservations_voucher_pack_id" on table "amount_reservations"

<My account>=# delete from access_clients where user_id in (select id from del_users);
ERROR: update or delete on table "access_clients" violates foreign key constraint "fk_transactions_access_client_id" on table "transactions"

Please help us

Thank you very much.

trustpay
Posts: 70
Joined: Mon Aug 03, 2015 10:19 am

Re: Copy Configuration without current data

Post by trustpay »

Please be informed that after running scripts with errors, result of DB is as below:
- Can delete: transaction, user balance, all account balances
- Cannot delete: User accounts, but it seems be deleted some part inside, cannot log in any more... Also cannot delete voucher, Authorization records, messages...

alexandre
Posts: 907
Joined: Wed Sep 06, 2006 9:06 am

Re: Copy Configuration without current data

Post by alexandre »

Hi,
I fixed the script, so you can download and run it again:
https://drive.google.com/file/d/0B4kJMn ... sp=sharing

The only condition that will fail is that if you have transfer fees, transaction types or voucher types that are restricted to be used by some user you must remove this condition before run the script.
Eg. A transfer fee that is charged or payed for some user. A transaction type that is restricted to be used by some user. A voucher type that can be redeemed only by some user.

Regards.
Alexandre Caurrinhos
Cyclos development team.

trustpay
Posts: 70
Joined: Mon Aug 03, 2015 10:19 am

Re: Copy Configuration without current data

Post by trustpay »

alexandre wrote:Hi,
I fixed the script, so you can download and run it again:
https://drive.google.com/file/d/0B4kJMn ... sp=sharing

The only condition that will fail is that if you have transfer fees, transaction types or voucher types that are restricted to be used by some user you must remove this condition before run the script.
Eg. A transfer fee that is charged or payed for some user. A transaction type that is restricted to be used by some user. A voucher type that can be redeemed only by some user.

Regards.

Thanks for help, alexandre! :D

trustpay
Posts: 70
Joined: Mon Aug 03, 2015 10:19 am

Re: Copy Configuration without current data

Post by trustpay »

alexandre wrote:Hi,
I fixed the script, so you can download and run it again:
https://drive.google.com/file/d/0B4kJMn ... sp=sharing
...
Dear alexandre,

When running your scripts, it shows error as below:

ERROR: update or delete on table "transactions" violates foreign key constraint "fk_failed_payment_occurrences_recurring_payment_id" on table "failed_payment_occurrences"

Please help us

Thank you very much.

alexandre
Posts: 907
Joined: Wed Sep 06, 2006 9:06 am

Re: Copy Configuration without current data

Post by alexandre »

Hi,

Sorry my database doesn't have this kind of data, but now it should be fixed.
Please download the file again with the following link to use with Cyclos 4.8.2:
https://drive.google.com/file/d/0B4kJMn ... sp=sharing

If it doesn't work please let me know.
Regards
Alexandre Caurrinhos
Cyclos development team.

trustpay
Posts: 70
Joined: Mon Aug 03, 2015 10:19 am

Re: Copy Configuration without current data

Post by trustpay »

hi

I run script again, and it show below error:
<my account>=# delete from users where id in (select id from del_users);
ERROR: update or delete on table "users" violates foreign key constraint "fk_voucher_types_payment_destination_user_id" on table "voucher_types"

Pls help us for this, thank you

alexandre
Posts: 907
Joined: Wed Sep 06, 2006 9:06 am

Re: Copy Configuration without current data

Post by alexandre »

Hi,

It's a voucher type that pay to a fixed user. So It should be removed on Cyclos before run the script.
It's a kind of configuration, so I cannot delete It with the script.

Regards.
Alexandre Caurrinhos
Cyclos development team.

Post Reply