Jump to content

Deleted all the employees


Recommended Posts

Ouch. If you have a database backup, the easiest thing to do would be to restore the database to another location and copy the data from the restored database to the original. Even easier would be to look at the database backup file (since it should just be plain SQL) and find the INSERT statements related to the DBPREFIX_employee table. Copy those INSERT statements and execute them in your database.

However, I'll assume that ALL employees were deleted and you don't have a backup, but you do have access to phpMyAdmin to directly alter the database.

The following applies to versions 1.4.x and 1.3.1.1. If you have an earlier version, let me know, and I will check into it.

The challenge will be recreating the employees with the same `id_employee` values, because those values are used in other tables. I'll stick to rebuilding the first Administrator employee you had during install.

Connect to the database and open a SQL window. Execute the following script, replacing the DBPREFIX_, LASTNAME, FIRSTNAME, EMAILADDRESS, and PASSWORD values with your appropriate values:

INSERT INTO `DBPREFIX_employee` (`id_employee`, `id_profile`, `lastname`, `firstname`, `email`, `passwd`, `active`) VALUES (1, 1, 'LASTNAME', 'FIRSTNAME', 'EMAILADDRESS', 'PASSWORD', 1); ALTER TABLE `DBPREFIX_employee` AUTO_INCREMENT = 1;



This will get you the first Administrator back online. From there, you can add the other employees back. It would be best to add them in the same order as the first time, so they are properly related back to other tables (e.g. message, order_history, etc).

Good luck

Link to comment
Share on other sites

Have you used phpMyAdmin before? It is not a PrestaShop component, but a different software entirely that is often provided by your hosting company.

If you don't have phpMyAdmin, I may not be much help. I'm great with SQL and relational database management, but my experience managing remote MySQL databases is a weakness. Somehow, you need to get direct database access to run that query.

Link to comment
Share on other sites

Unfortunately, no. The employee data is stored in the database, so you need someway to actually manipulate the data.

How did you delete all the employees? What happened? Were you editing on the Employees tab, selected all employees, and hit Delete Selected? Did it ask you, "Are you sure?"

I'm not versed in PHP well enough to try it, but maybe someone else on the forum could whip up the code for a page that could perform the insert. Then you could put that php page on your site and call it from a browser. That's the only other option that comes to mind. Sorry.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...