Skip to content
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

Slim Application Error -Arch Linux #122

Closed
fallenczar opened this issue Dec 23, 2018 · 11 comments
Closed

Slim Application Error -Arch Linux #122

fallenczar opened this issue Dec 23, 2018 · 11 comments
Labels

Comments

@fallenczar
Copy link

Slim Application Error
The application could not run because of the following error:

Details
Type: PDOException
Code: HY000
Message: SQLSTATE[HY000]: General error: 1 duplicate column name: opened_date
File: /var/git/grocy/1.23.1/services/DatabaseService.php
Line: 45
Trace
#0 /var/git/grocy/1.23.1/services/DatabaseService.php(45): PDO->exec('ALTER TABLE sto...')
#1 /var/git/grocy/1.23.1/services/DatabaseMigrationService.php(47): Grocy\Services\DatabaseService->ExecuteDbStatement('ALTER TABLE sto...')
#2 /var/git/grocy/1.23.1/services/DatabaseMigrationService.php(23): Grocy\Services\DatabaseMigrationService->ExecuteSqlMigrationWhenNeeded(46, 'ALTER TABLE sto...')
#3 /var/git/grocy/1.23.1/controllers/LoginController.php(70): Grocy\Services\DatabaseMigrationService->MigrateDatabase()
#4 [internal function]: Grocy\Controllers\LoginController->Root(Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#5 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(41): call_user_func(Array, Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#6 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/Route.php(356): Slim\Handlers\Strategies\RequestResponse->__invoke(Array, Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#7 /var/git/grocy/1.23.1/middleware/SessionAuthMiddleware.php(26): Slim\Route->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#8 [internal function]: Grocy\Middleware\SessionAuthMiddleware->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\Route))
#9 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Grocy\Middleware\SessionAuthMiddleware), Array)
#10 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\Route))
#11 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\Route))
#12 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->Slim{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))
#13 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/Route.php(334): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#14 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/App.php(515): Slim\Route->run(Object(Slim\Http\Request), Object(Slim\Http\Response))
#15 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#16 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/App.php(406): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#17 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/App.php(314): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
#18 /var/git/grocy/1.23.1/app.php(71): Slim\App->run()
#19 /var/git/grocy/1.23.1/public/index.php(3): require_once('/var/git/grocy/...')
#20 {main}

SQLite 3.26.0-1

@fallenczar fallenczar changed the title Slim Application Error Slim Application Error -Arch Linux Dec 23, 2018
@berrnd
Copy link
Member

berrnd commented Dec 23, 2018

Hm, cannot reproduce this on my side, in migration 46 there is a new column opened_date added to two tables, so no column duplication:

ALTER TABLE stock
ADD opened_date DATETIME;

ALTER TABLE stock_log
ADD opened_date DATETIME;

Can only imagine that the migration did not run completely and then was executed again a second time...

Does this happen again when you delete the database file and let it be created again?

@fallenczar
Copy link
Author

i get a new error

Details
Type: PDOException
Code: HY000
Message: SQLSTATE[HY000]: General error: 1 no such table: main.recipes_pos_old
File: /var/git/grocy/1.23.1/services/DatabaseService.php
Line: 45
Trace
#0 /var/git/grocy/1.23.1/services/DatabaseService.php(45): PDO->exec('ALTER TABLE sto...')
#1 /var/git/grocy/1.23.1/services/DatabaseMigrationService.php(47): Grocy\Services\DatabaseService->ExecuteDbStatement('ALTER TABLE sto...')
#2 /var/git/grocy/1.23.1/services/DatabaseMigrationService.php(23): Grocy\Services\DatabaseMigrationService->ExecuteSqlMigrationWhenNeeded(46, 'ALTER TABLE sto...')
#3 /var/git/grocy/1.23.1/controllers/LoginController.php(70): Grocy\Services\DatabaseMigrationService->MigrateDatabase()
#4 [internal function]: Grocy\Controllers\LoginController->Root(Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#5 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(41): call_user_func(Array, Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#6 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/Route.php(356): Slim\Handlers\Strategies\RequestResponse->__invoke(Array, Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#7 /var/git/grocy/1.23.1/middleware/SessionAuthMiddleware.php(26): Slim\Route->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#8 [internal function]: Grocy\Middleware\SessionAuthMiddleware->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\Route))
#9 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/DeferredCallable.php(43): call_user_func_array(Object(Grocy\Middleware\SessionAuthMiddleware), Array)
#10 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\Route))
#11 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\Route))
#12 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->Slim\{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))
#13 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/Route.php(334): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#14 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/App.php(515): Slim\Route->run(Object(Slim\Http\Request), Object(Slim\Http\Response))
#15 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#16 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/App.php(406): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#17 /var/git/grocy/1.23.1/vendor/slim/slim/Slim/App.php(314): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
#18 /var/git/grocy/1.23.1/app.php(71): Slim\App->run()
#19 /var/git/grocy/1.23.1/public/index.php(3): require_once('/var/git/grocy/...')
#20 {main}

@berrnd
Copy link
Member

berrnd commented Dec 23, 2018

Seems again that the database migrations (before 46) did not run completely...

So you deleted the /data/grocy.db file and there are no other errors inbetween (maybe please also check the PHP/webserver logs)?

@fallenczar
Copy link
Author

unfortunately the only entry in the logs are:

::1 - - [24/Dec/2018:02:11:23 +0000] "GET / HTTP/1.1" 500 1061

i switched to 1.22.0 and was able to get it running.

Regards

@berrnd
Copy link
Member

berrnd commented Dec 24, 2018

Hm, strange ... behind the 500 error (Internal Server Error) somewhere there must be some more error message ... so sorry, no idea - just ensure that you run PHP 7.2, that was a problem on many other places in the last time...

@fallenczar
Copy link
Author

i am running 7.3 , however as 1.22.0 , i will stick to it.
btw, awesome app. Thank you for the hard work.

@berrnd
Copy link
Member

berrnd commented Jan 4, 2019

Just to let you know, I could reproduce this now thanks to @jinks - this will be fixed when #133 is closed (next release).

@j0nnymoe
Copy link

Hi @berrnd - when do you plan to push the next release of grocy? Thanks

@berrnd
Copy link
Member

berrnd commented Jan 10, 2019

Sorry for the delay on new features and fixes currently - I wanted to do a bit more tests with exactly the reported environments.

It would help if someone can do a short test, attached there is the v1.24.0 release with the (fixed) migrations from current master branch.

grocy_1.24.0-patched.zip

@kminhc
Copy link

kminhc commented Jan 10, 2019

I didn't use your Zip, though i modified/added the affected SQL scripts with the changes from your commit 43c9ab7. It does work on a new install now.

@berrnd
Copy link
Member

berrnd commented Jan 10, 2019

@kminhc thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants