New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade from 3.2 to 3.3.8 failed: database upgrade.php ignores error SQLSTATE[42S22]: Column not found: 1054 Unknown column 'password_expiry' in 'field list' #489
Comments
btw: the following helped me to fix the problem: show traces with xdebug: enable PHP error display:
|
Hey... hmm.. So, I guess I just figured out that this was my issue, thanks to this bug report and #413 . But, now I am sort of stuck, afraid to make a move. I have been using this thing, getting angry and annoyed with it showing blank pages, figuring something was wrong with my PHP, but still seemingly working to create new aliases (which is all I really use it for), only to stop working altogether, recently. And, like a burned-out IT admin, I just have been hopping into the database and insert'ing new aliases by hand to keep things moving, until today when I decided to hunt the problem down. So, I now have a database which is in an odd state (thanks to this issue in the code, but also thanks to my procrastination). Could we get more detail about what the DB would look like before and after fixing this? Is my DB totally hosed, now? Or, is this just a matter of poking one or two columns into a table or two and populating them with something reasonable, by hand? How could a guy fix this manually, after ... waaay after... installation, is my question. |
@lleevveell66 I guess finding out what state your database is in, would be a good start. Have you tried running : UPDATE domain SET created='2000-01-01',modified='2000-01-01' WHERE domain='ALL'; and then : ALTER TABLE domain ADD COLUMN password_expiry int DEFAULT 0; and : update config set value=1841; and then visiting upgrade.php in a web browser? |
Thank you! I had done the UPDATE domain SET created='2000-01-01',modified='2000-01-01' WHERE domain='ALL'; part, but not the ALTER TABLE domain ADD COLUMN password_expiry int DEFAULT 0; parts. I just ran those, and I can list aliases, make a new alias, and everything, again! (How important is it that I run "upgrade.php", now? Can I get away without it?) |
You should run upgrade.php. PostfixAdmin may break if the database schema is out of sync with the code. |
Ok. Thanks. Does this sound like it has worked?:
|
Yes that looks good. |
We had the same error as in #413. We upgraded to Ubuntu 20.04 with MySQL 8.0.
A deep dive showed the following problem:
The database migration script upgrade.php seems to have insufficient error handling. It should stop execution when an error occurs, but it continued silently in our case.
Details: https://github.com/postfixadmin/postfixadmin/blob/master/public/upgrade.php#L1991 executes the following SQL:
ALTER TABLE
domainADD COLUMN password_expiry int DEFAULT 0;
In our case it failed with:
ERROR 1292 (22007): Incorrect datetime value: '0000-00-00 00:00:00' for column 'created' at row 1
The reason:
Solution for incorrect datetime value:
UPDATE domain SET created='2000-01-01',modified='2000-01-01' WHERE domain='ALL';
Please add this as a database migration!
Solution to re-run the migration:
update config set value=1841;
Run upgrade.php again in your browser:
https://example.com/postfixadmin/upgrade.php?debug=1
The migration should work now.
Summary:
Thank you for creating and maintaining postfixadmin!
The text was updated successfully, but these errors were encountered: