Coder Social home page Coder Social logo

Comments (25)

yayitazale avatar yayitazale commented on July 30, 2024 1

Same result.

from kimai2.

kevinpapst avatar kevinpapst commented on July 30, 2024 1

The initial error comes up, because you run Kimai with a version that expects certain database tables/fields, but they are missing. That is very likely, becuase the migration status is your db is wrong.

You already have that migration: https://github.com/kevinpapst/kimai2/blob/master/src/Migrations/Version20190730123324.php
But this one is likely missing:
https://github.com/kevinpapst/kimai2/blob/master/src/Migrations/Version20191024100951.php

And the new ones are not executed, because the migration stops due to the error Failed to set migration status: The table with name 'kimai.kimai2_teams' already exists..

You can fix that by running docker with your original Kimai version (that is really important!) and then executing this console command: bin/console doctrine:migrations:version --add --all. This will tell Kimai, that all currently existing migrations were executed. If you do this with a wrong codebase, you could miss required db changes.

Create a DB backup first, before running the command.
After executing the console command, try to upgrade docker again.

from kimai2.

kevinpapst avatar kevinpapst commented on July 30, 2024 1

The teams table was added with Kimai 1.2 which I don't understand why you are using 0.9... but thats another topic. So the table kimai2_teams is created with Migration "Version20190730123324" so you need at least all until this one in the tables:

INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180701120000', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180715160326', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180730044139', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180805183527', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180903202256', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180905190737', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180924111853', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20181031220003', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190124004014', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190201150324', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190219200020', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190305152308', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190321181243', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190502161758', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190510205245', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190605171157', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190617100845', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190706224211', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190706224219', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190729162655', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190730123324', '2019-09-13 14:53:06');

The next ones might be necessary to be executed by the upgrader (don't import them at first!). Run the upgrade script after executing the above SQLs. If the upgrade script fails with a DB problem add the next line (always just one) from below and re-run the upgrade script ... until it finally runs successful.

INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190813162649', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20191024100951', '2019-10-24 10:24:23');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20191108151534', '2019-11-09 00:25:44');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20191113132640', '2019-11-16 11:14:00');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20191116110124', '2019-11-16 18:32:47');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20191204120823', '2019-12-17 11:21:29');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20200109102138', '2020-01-16 12:58:29');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20200112192905', '2020-01-12 19:31:45');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20200125123942', '2020-01-25 12:41:31');

from kimai2.

kevinpapst avatar kevinpapst commented on July 30, 2024 1

Ahhhhhhh ... it was the word "original" that caused all the extra work?
Communication via text is so confusing sometimes 😁 glad it works now.

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

Can you please share:

  1. the command you use to start the container.
  2. docker compose (if used) file with any passwords redacted.
  3. The log/cli output of the failed container,

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

sudo docker-compose pull && sudo docker-compose up -d --build
2.

version: '3.5'
services:
  mydb:
    image: mysql:latest
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimaiuser
      - MYSQL_PASSWORD=kimaipassword
      - MYSQL_ROOT_PASSWORD=changemeplease
    volumes:
      - mysql:/var/lib/mysql
    command: --default-storage-engine innodb
    restart: unless-stopped
 kimai:
    image: kimai/kimai2:apache-debian-1.5-prod
    environment:
      - APP_ENV=prod
    depends_on:
     - mydb
    restart: unless-stopped
    ports:
      - 80:8001

volumes:
   mysql:

`Wait for db connection ...
Connection established
first run - install kimai

Kimai installation running ...

 ! [NOTE] Database is existing and connection could be established              

                                                              
                    Application Migrations                    
                                                              

Migrating up to 20191116110124 from 20190729162655

  ++ migrating 20190730123324 (Creates user team and permission tables)

Migration 20190730123324 failed during Execution. Error The table with name 'kimai.kimai2_teams' already exists.
 [ERROR] Failed to set migration status: The table with name                    
         'kimai.kimai2_teams' already exists.                                   

Kimai2 ready
[Tue Dec 10 10:11:38.295282 2019] [mpm_prefork:notice] [pid 27] AH00163: Apache/2.4.38 (Debian) PHP/7.3.10 configured -- resuming normal operations
[Tue Dec 10 10:11:38.295345 2019] [core:notice] [pid 27] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'`

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

Still gettin this error. ¿Any clue?

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

We have rebuilt the whole architecture. Could you try again please?

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

Did Kevin's fix work for you?

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

It doesn't work. It says error while executing the command and the result is the same error again with the new version.

from kimai2.

kevinpapst avatar kevinpapst commented on July 30, 2024

It doesn't work. It says error while executing the command and the result is the same error again with the new version.

What is "it"? Without command output no help is possible.

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

ERROR [console] Error thrown while running command "doctrine:migrations:version --add --all". Message: "Environment variable not found: "DATABASE_PREFIX"." ["exception" => Symfony\Component\DependencyInjection\Exception\EnvNotFoundException { …},"command" => "doctrine:migrations:version --add --all","message" => "Environment variable not found: "DATABASE_PREFIX"."]

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

@yayitazale We have had big refactor over xmas. Could you please pull a new version and retry please.

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

Same result.

I have launched 0.8 first and executed the command, the first time the results is this:

bin/console doctrine:migrations:version --add --all

malloc: unknown:0: assertion botched
free: called with already freed block argument
last command: (null)

And I get kick out of the containers bash.

If I try again the same command this is the result:

bin/console doctrine:migrationes:version --add --all

                                                                                        
 [WARNING] Some commands could not be registered:                                       
                                                                                        

In EnvVarProcessor.php line 77:
                                                      
  Environment variable not found: "DATABASE_PREFIX".  
                                                      

After that error launching the apache-debian-master-prod version gives me the same log result and 500 error on the login page:

Kimai installation running ...
==============================

Database kimai for connection named default already exists. Skipped.
                                                              
                    Application Migrations                    
                                                              

Migrating up to 20200109102138 from 20190729162655

  ++ migrating 20190730123324 (Creates user team and permission tables)

Migration 20190730123324 failed during Execution. Error The table with name 'kimai.kimai2_teams' already exists.
 [ERROR] Failed to set migration status: The table with name                    
         'kimai.kimai2_teams' already exists.

I'm trying to edit the .env file to modify the DATABASE_PREXIF but I can't because I'm not root on the container....

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

Not the greatest answer but if you connect as root you can edit the .env file

docker exec -ti --user root NAME bash

from kimai2.

kevinpapst avatar kevinpapst commented on July 30, 2024

As both of your tries failed, the outcome was expectable.
Try DATABASE_PREFIX=kimai2_ bin/console doctrine:migrations:version --add --all, but I am not sure if the underscore is part of the prefix

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024
ERROR     [console] Error thrown while running command "doctrine:migrations:version --add --all". Message: "An exception occurred in driver: SQLSTATE[HY000] [2006] MySQL server has gone away" ["exception" => Doctrine\DBAL\Exception\DriverException { …},"command" => "doctrine:migrations:version --add --all","message" => "An exception occurred in driver: SQLSTATE[HY000] [2006] MySQL server has gone away"]

In AbstractMySQLDriver.php line 106:
                                                                                      
  An exception occurred in driver: SQLSTATE[HY000] [2006] MySQL server has gone away  
                                                                                      

In PDOConnection.php line 31:
                                                     
  SQLSTATE[HY000] [2006] MySQL server has gone away  
                                                     

In PDOConnection.php line 27:
                                                     
  SQLSTATE[HY000] [2006] MySQL server has gone away  
                                                     

In PDOConnection.php line 27:
                                                                                    
  PDO::__construct(): Unexpected server respose while doing caching_sha2 auth: 109

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

Same result with and without underscore

from kimai2.

kevinpapst avatar kevinpapst commented on July 30, 2024

PDO::__construct(): Unexpected server respose while doing caching_sha2 auth: 109

Never seen an error like that, but the internet knows more:
https://zeshankhattak.com/posts/pdo-construct-unexpected-server-respose-while-doing-caching-sha2-auth-109

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

Same error...

ERROR [console] Error thrown while running command "doctrine:migrations:version --add --all". Message: "An exception occurred in driver: SQLSTATE[HY000] [2006] MySQL server has gone away" ["exception" => Doctrine\DBAL\Exception\DriverException { …},"command" => "doctrine:migrations:version --add --all","message" => "An exception occurred in driver: SQLSTATE[HY000] [2006] MySQL server has gone away"]

In AbstractMySQLDriver.php line 106:

An exception occurred in driver: SQLSTATE[HY000] [2006] MySQL server has gone away

In PDOConnection.php line 31:

SQLSTATE[HY000] [2006] MySQL server has gone away

In PDOConnection.php line 27:

SQLSTATE[HY000] [2006] MySQL server has gone away

In PDOConnection.php line 27:

PDO::__construct(): Unexpected server respose while doing caching_sha2 auth: 109

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

I also changed the timeout value to a bigger one in the mysql with no effects on the result.

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

@yayitazale Can you install get the 0.8 version of Kimai running on a native (non-contaner) host?

Then run the upgrade please. Lets see if it's the container or the state of the DB.

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

I think i'm going to start a fresh install...

from kimai2.

kevinpapst avatar kevinpapst commented on July 30, 2024

You just need to get these numbers into the database migration_versions:
Bildschirmfoto 2020-01-30 um 10 07 50
Not all of them, but the correct ones... they map to the files in the directory src/Migrations/

If one fails (eg because the datable already exists) then add this one to the table until the update routine works.

from kimai2.

yayitazale avatar yayitazale commented on July 30, 2024

The teams table was added with Kimai 1.2 which I don't understand why you are using 0.9... but thats another topic. So the table kimai2_teams is created with Migration "Version20190730123324" so you need at least all until this one in the tables:

INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180701120000', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180715160326', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180730044139', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180805183527', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180903202256', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180905190737', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20180924111853', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20181031220003', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190124004014', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190201150324', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190219200020', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190305152308', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190321181243', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190502161758', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190510205245', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190605171157', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190617100845', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190706224211', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190706224219', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190729162655', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190730123324', '2019-09-13 14:53:06');

The next ones might be necessary to be executed by the upgrader (don't import them at first!). Run the upgrade script after executing the above SQLs. If the upgrade script fails with a DB problem add the next line (always just one) from below and re-run the upgrade script ... until it finally runs successful.

INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20190813162649', '2019-09-13 14:53:06');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20191024100951', '2019-10-24 10:24:23');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20191108151534', '2019-11-09 00:25:44');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20191113132640', '2019-11-16 11:14:00');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20191116110124', '2019-11-16 18:32:47');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20191204120823', '2019-12-17 11:21:29');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20200109102138', '2020-01-16 12:58:29');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20200112192905', '2020-01-12 19:31:45');
INSERT INTO kimai2.migration_versions (version, executed_at) VALUES ('20200125123942', '2020-01-25 12:41:31');

I was using the 0.8 becauce you told

You can fix that by running docker with your original Kimai version (that is really important!)

Running the migration from 1.2 worked without adding any version manually...

Sorry about my ignorance abut SQL and doctrine...

Thank you two for your time and help.

from kimai2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.