cachet icon indicating copy to clipboard operation
cachet copied to clipboard

Migrate Cachet 2.x to 3.x

Open TecSecret opened this issue 1 year ago • 6 comments

How to migrate from cachet 2.x to 3.x without losing status page data currently?

According to the docs.cachethq.io documentation, the php artisan migrate command presents an error.

TecSecret avatar Dec 09 '24 12:12 TecSecret

@TecSecret thanks for checking out Cachet 3.x. Keep in mind that automatically migrating from 2.x to 3.x isn't completely finished yet.

Can you please provide the error you're seeing when running php artisan migrate? This will help us look into any specific issues you're facing.

jbrooksuk avatar Dec 09 '24 22:12 jbrooksuk

I am getting an error when migrating from 2.4.1 to 3.x as well.

INFO  Running migrations.

 2014_10_12_000000_create_users_table ................................................................................................. 2.08ms FAIL

  Illuminate\Database\QueryException

 SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (Connection: mysql, SQL: create table `users` (`id` bigint unsigned not null auto_increment primary key, `name` varchar(255) not null, `email` varchar(255) not null, `email_verified_at` timestamp null, `password` varchar(255) not null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

 at vendor/laravel/framework/src/Illuminate/Database/Connection.php:825
   821â–•                     $this->getName(), $query, $this->prepareBindings($bindings), $e
   822â–•                 );
   823â–•             }
   824â–•
 ➜ 825▕             throw new QueryException(
   826â–•                 $this->getName(), $query, $this->prepareBindings($bindings), $e
   827â–•             );
   828â–•         }
   829â–•     }

     +9 vendor frames

 10  database/migrations/2014_10_12_000000_create_users_table.php:22
     Illuminate\Support\Facades\Facade::__callStatic()
     +26 vendor frames

 37  artisan:13
     Illuminate\Foundation\Application::handleCommand()

jerahl avatar Dec 10 '24 13:12 jerahl

Can you please dump your migrations table?

jbrooksuk avatar Dec 10 '24 15:12 jbrooksuk

migrations.txt

jerahl avatar Dec 10 '24 16:12 jerahl

Hey hi,

I'm happy to see cachet is back on track with a 3.x version :) Thanks a lot for your work. I tried the demo and it looks great.

I cloned our 2.4 database and attempted a migration and have the same issue reported here.

  INFO  Running migrations.  

  2014_10_12_000000_create_users_table ................................................................................................. 4.24ms FAIL

   Illuminate\Database\QueryException 

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (Connection: mysql, SQL: create table `users` (`id` bigint unsigned not null auto_increment primary key, `name` varchar(255) not null, `email` varchar(255) not null, `email_verified_at` timestamp null, `password` varchar(255) not null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:825
    821â–•                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    822â–•                 );
    823â–•             }
    824â–• 
  ➜ 825▕             throw new QueryException(
    826â–•                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    827â–•             );
    828â–•         }
    829â–•     }

I'm aware this is a work in very progress, but wanted to let you know anyway :)

sriccio avatar Jun 28 '25 04:06 sriccio

There should be some checks in the migration for existing table and keys which were added in v2, if exists, it should not cause issue. The v2 version allow login with username and v3 does not!. The v3 look for name column and it was not in v2 and it's coming from default migration received from migration. This table have unsignedInteger for column id but in v3, for api_keys table it's looking for integer and hence migration is faling. Sorry to say but this time team have released the product without any proper testing.

KumarSunil007 avatar Dec 06 '25 16:12 KumarSunil007