Jump to content

Clear Customer Data Function For Admin


BeDazzler

Recommended Posts

Hi Dev Team,

 

We have been testing Blesta and the API integration with our systems, which often requires a reset and clearing out of customer data so we can re-use the same email addresses and customer details from scratch.

 

Can we please add to the feature list a function in the admin section to 'Clear Customer Data'.

 

The goal would be to remove all customer data, including history of tickets and invoices, resetting the database back to a clean setup with all the system wide configurable options - but not the customer data.

 

Cheers,

 

D.

Link to comment
Share on other sites

Hi Dev Team,

 

We have been testing Blesta and the API integration with our systems, which often requires a reset and clearing out of customer data so we can re-use the same email addresses and customer details from scratch.

 

Can we please add to the feature list a function in the admin section to 'Clear Customer Data'.

 

The goal would be to remove all customer data, including history of tickets and invoices, resetting the database back to a clean setup with all the system wide configurable options - but not the customer data.

 

Cheers,

 

D.

I can tell you right now people have suggested the purging of tickets and the devs are strictly against implementing it for a few reasons (quick search of the forum will give you why).

 

What you're explaining doesn't require a feature set, but more so just create a backup of the database at the point you will need to later start fresh from, do your work, then just drop all the tables in the database and reimport your backup.

 

Its really not that hard and you can even use a oneliner to purge them (or add a DROP TABLE case for each table in the backup file): mysql --user=YOUR_USERNAME --password=YOUR_PASSWORD -BNe "show tables" YOUR_DBSCHEMA_NAME | tr '\n' ',' | sed -e 's/,$//' | awk '{print "SET FOREIGN_KEY_CHECKS = 0;DROP TABLE IF EXISTS " $1 ";SET FOREIGN_KEY_CHECKS = 1;"}' | mysql --user=YOUR_USERNAME --password=YOUR_PASSWORD YOUR_DBSCHEMA_NAME

Link to comment
Share on other sites

Hi There,

 

Thanks for the reply.

 

Yes I understand that clearing customer data can cause issues with history, etc, however we shouldn't have to create custom SQL scripts just to clear databases when testing.

 

This is 2014.

 

D.

I think that having these scripts for testing makes perfect sense personally.  I would not want that functionally to be available in my production code as I would not want any of my data deleted if I can help it.  This is where one off scripts help solve these problems.

 

On the same note can't you extend the api via a module to add those features in for yourself if you need them?

Link to comment
Share on other sites

I think that having these scripts for testing makes perfect sense personally.  I would not want that functionally to be available in my production code as I would not want any of my data deleted if I can help it.  This is where one off scripts help solve these problems.

 

On the same note can't you extend the api via a module to add those features in for yourself if you need them?

You can extend the API to create the functionality, yes.  I'm actually working on a database plugin to do things such as restore from a backup and such right now.  I'll add this to the feature set of it.

 

I could see this being viable by default if Blesta included a "Developer enabled" switch or something.  But, as a production-ready product like it stands now, not so much.

Link to comment
Share on other sites

Yes of course I wouldn't want this functionality to be accidentally used in production, but I think most people here are pretty clever and the function could have a double checkbox and a "are you sure, enter I agree or destroy here" to make sure it's not accidentally used.

 

Many thanks.

Link to comment
Share on other sites

I started work on a database manager plugin here: http://www.blesta.com/forums/index.php?/topic/1847-database-manager-v001-a/

 

What's left is pretty simple compared to what I went through yesterday.  So, its going to be polished up today.  Later on I might make it more advanced (i.e.: delete data from a specific client), which wouldn't be difficult to do.  Probably work on that today as a separate feature.  Make that a widget.

 

Look for that today as well.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...