Admin database restore

Open to all! Ask other shopowners for help.
Post Reply
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Admin database restore

Post by Pierre_P »

I am trying to restore a backup through my admin side but it's complaining and fatal errors.
I did check the file paths to be correct.
Tried on local test server and live server

Phoenix v1.0.9.10
PHP 8.2

Code: Select all

Fatal error: Uncaught mysqli_sql_exception: Invalid default value for 'date_added' in /--removed--/includes/system/versioned/1.0.8.9/sql_file.php:45 Stack trace: #0 /--removed--/includes/system/versioned/1.0.8.9/sql_file.php(45): mysqli->next_result() #1 /--removed--/includes/system/versioned/1.0.8.9/sql_file.php(50): sql_file->run_sql('# CE Phoenix, E...') #2 /--removed--/includes/system/versioned/1.0.8.9/sql_file.php(117): sql_file->run_sql_or_die('# CE Phoenix, E...') #3 /--removed--/includes/system/versioned/1.0.8.9/sql_file.php(147): sql_file->restore_sql('/usr/www/users/...') #4 /--removed--/admin/includes/actions/backup/restore_now.php(16): sql_file->decompress_and_restore() #5 /--removed--/admin/includes/segments/process_action.php(19): require('/usr/www/users/...') #6 /--removed--/admin/backup.php(30): require('/usr/www/users/...') #7 {main} thrown in /--removed--/includes/system/versioned/1.0.8.9/sql_file.php on line 45


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Admin database restore

Post by burt »

https://stackoverflow.com/questions/919 ... tamp-field
That is because of server SQL Mode - NO_ZERO_DATE.

From the reference: NO_ZERO_DATE - In strict mode, doesn't allow '0000-00-00' as a valid date. You can still insert zero dates with the IGNORE option. When not in strict mode, the date is accepted but a warning is generated.
I am not here to build for you.
I am here to build with you. Let's help each other.
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Re: Admin database restore

Post by Pierre_P »

Understandable the date is set to NOW() i suppose in the sql

This happens also in a new install.
Where to fix?
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Admin database restore

Post by ecartz »

Pierre_P wrote: Tue Dec 31, 2024 11:23 am Where to fix?
I'd try the table definition in the SQL. Try running the table definition SQL manually in phpMyAdmin or similar to see if it gives better error messages. If that runs without errors, try the inserts with date_added.

Or turn off NO_ZERO_DATE or strict mode on the database.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply