Cachet: SQLSTATE[HY000]: General error: 17 database schema has changed

Created on 22 Jul 2016  ·  22Comments  ·  Source: CachetHQ/Cachet

Before submitting your issue, please make sure that you've checked the checkboxes below.

  • [X] I am running the latest release version of Cachet.
  • [X] I am running at least PHP 5.5.9. _You can check this by running php -v._
  • [X] I have ran rm -rf bootstrap/cache/*.

Expected behaviour

The Install script works.

Actual behaviour

The install script fails with these errors:

Configuration cache cleared!
Configuration cached successfully!
Route cache cleared!
Routes cached successfully!
Copied Directory [/vendor/roumen/feed/src/views] To [/resources/views/vendor/feed]
Publishing complete for tag []!
Migration table created successfully.


  [Illuminate\Database\QueryException]
  SQLSTATE[HY000]: General error: 17 database schema has changed (SQL: insert into "migrations" ("migration", "batch") values (2015_01_05_201324_CreateComponentG
  roupsTable, 1))



  [PDOException]
  SQLSTATE[HY000]: General error: 17 database schema has changed

Steps to reproduce

  1. touch storage/database.sqlite
  2. chmod 777 storage/database.sqlite
  3. run php artisan app:install
Bug DatabasSQLite

Most helpful comment

This is now fixed.

All 22 comments

Can we see the DB_* portions of your .env file please.

DB_DRIVER=sqlite
DB_DATABASE=/var/www/Cachet/storage/database.sqlite

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=database
CACHET_EMOJI=false

/var/www/Cachet/storage/database.sqlite exists and is chmod 777 (as is storage)

Please run:

cat VERSION
php --version
$ cat VERSION
2.3.6

$ php --version
PHP 5.5.9-1ubuntu4.17 (cli) (built: May 19 2016 19:05:57)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

If I run install twice in a row on a new sqlite db then I get the following the second time around, so the first step must be doing stuff to the db:

Publishing complete for tag []!


  [Illuminate\Database\QueryException]
  SQLSTATE[HY000]: General error: 1 table "component_groups" already exists (SQL: create table "component_groups" ("id" integer no
  t null primary key autoincrement, "name" varchar not null, "created_at" datetime null, "updated_at" datetime null))



  [PDOException]
  SQLSTATE[HY000]: General error: 1 table "component_groups" already exists

@CachetHQ/owners any clue on this?

Okay, it seems to be a bug specifically with php artisan app:install. You can run php artisan migrate to get migrations working.

I moved over to MySQL to work around this.

I'm glad you're up and running.

We'll still continue to solve this issue though 👍

Just been bitten by this. Running migrate before install works, but not the other way around. Then, running install again yields an error/warning:

array_key_exists() expects parameter 2 to be array, null given

I don't know what that means and if it matters. Full output:

Clearing settings cache...
Settings cache cleared!
Backing up database...
Dumping database and uploading...
array_key_exists() expects parameter 2 to be array, null given
Backup skipped!
Backup completed!
Application key [base64:key] set successfully.
Configuration cache cleared!
Configuration cached successfully!
Route cache cleared!
Routes cached successfully!
Copied Directory [/vendor/roumen/feed/src/views] To [/resources/views/vendor/feed]
Publishing complete for tag []!
Nothing to migrate.
Clearing cache...
Application cache cleared!
Cache cleared!

I don't have any DB_* entries in my .env file. I let Cachet use the default values.

The second error you get @axilleas is due to the backup commands, we'll clear up those warnings too I think.

Awesome, thanks :)

We now ignore SQLite from backups. The php artisan app:install command is not fixed though yet.

This is now fixed.

@jbrooksuk seems this bug is back :/

I'm trying to update from 2.3.11 to 2.4 (latest) using SQLite and I get:

  [Illuminate\Database\QueryException]                                                                                                                                            
  SQLSTATE[HY000]: General error: 17 database schema has changed (SQL: insert into "migrations" ("migration", "batch") values (2016_03_08_125729_CreateIncidentUpdatesTable, 2)) 
[Doctrine\DBAL\Driver\PDOException] 
SQLSTATE[HY000]: General error: 17 database schema has changed

Yes this is broken on current release.

Run php artisan migrate first, before app:install

Sorry, I forgot to say that running migrate first I get the same error.

Same error here, running https://github.com/MatheusRV/Cachet-Sandstorm/

this is an implementation of Cachet for Sandstorm.

What version are you using?

I am experiencing this same issue.

PHP version 5.5.9-1ubuntu4.21 (cli)

Cachet version 2.3.12

On my initial install with php artisan app:install:

Clearing settings cache...
Settings cache cleared!
Backup skipped: SQLite is not supported.
Application key [base64:D2/ynVJ0xE2qCpmA3znfzf5ViYDGbiU9+TNdOw69Vuk=] set successfully.
Configuration cache cleared!
Configuration cached successfully!
Route cache cleared!
Routes cached successfully!
Copied Directory [/vendor/roumen/feed/src/views] To [/resources/views/vendor/feed]
Publishing complete for tag []!


  [Illuminate\Database\QueryException]
  SQLSTATE[HY000]: General error: 1 table "component_groups" already exists (SQL: create table "component_grou
▽
ps" ("id" integer not null primary key autoincrement, "name" varchar not null,
   "created_at" datetime null, "updated_at" datetime null))



  [PDOException]
  SQLSTATE[HY000]: General error: 1 table "component_groups" already exists

php artisan migrate didn't help...

**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes



  [Illuminate\Database\QueryException]
  SQLSTATE[HY000]: General error: 1 table "component_groups" already exists (SQL: create table "component_g
  roups" ("id" integer not null primary key autoincrement, "name" varchar not null, "created_at" datetime n
  ull, "updated_at" datetime null))



  [PDOException]
  SQLSTATE[HY000]: General error: 1 table "component_groups" already exists

@ConnorVG did you figure this out? 🤔

I wonder if @taylorotwell has seen this issue previously?

I just ran into the same issue on a vagrant homestead VM I had set up for a previous Laravel project. I was able to get running by:

composer install --no-dev -o
touch ./database/database.sqlite
php artisan key:generate
php artisan app:install
echo "" > database/database.sqlite
php artisan migrate
php artisan app:install

My details:

php -v
PHP 7.0.13-1+deb.sury.org~xenial+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.13-1+deb.sury.org~xenial+1, Copyright (c) 1999-2016, by Zend Technologies
    with blackfire v1.14.1~linux-x64-non_zts70, https://blackfire.io, by Blackfireio Inc.

cat VERSION
2.4.0-dev
Was this page helpful?
0 / 5 - 0 ratings

Related issues

doreplado picture doreplado  ·  6Comments

BuckinghamIO picture BuckinghamIO  ·  3Comments

GrahamCampbell picture GrahamCampbell  ·  3Comments

meonkeys picture meonkeys  ·  6Comments

vesper8 picture vesper8  ·  6Comments