cachet icon indicating copy to clipboard operation
cachet copied to clipboard

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

Open ccosentino opened this issue 10 years ago • 22 comments

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

ccosentino avatar Jul 21 '16 22:07 ccosentino

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

jbrooksuk avatar Jul 22 '16 07:07 jbrooksuk

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)

ccosentino avatar Jul 22 '16 13:07 ccosentino

Please run:

cat VERSION
php --version

GrahamCampbell avatar Jul 22 '16 13:07 GrahamCampbell

$ 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

ccosentino avatar Jul 22 '16 13:07 ccosentino

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

ccosentino avatar Jul 22 '16 13:07 ccosentino

@CachetHQ/owners any clue on this?

jbrooksuk avatar Jul 29 '16 19:07 jbrooksuk

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

jbrooksuk avatar Jul 29 '16 19:07 jbrooksuk

I moved over to MySQL to work around this.

ccosentino avatar Jul 29 '16 20:07 ccosentino

I'm glad you're up and running.

We'll still continue to solve this issue though 👍

jbrooksuk avatar Jul 29 '16 20:07 jbrooksuk

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.

axilleas avatar Jul 31 '16 21:07 axilleas

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

jbrooksuk avatar Aug 01 '16 12:08 jbrooksuk

Awesome, thanks :)

axilleas avatar Aug 01 '16 12:08 axilleas

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

jbrooksuk avatar Aug 02 '16 10:08 jbrooksuk

This is now fixed.

jbrooksuk avatar Aug 08 '16 16:08 jbrooksuk

@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

axilleas avatar May 20 '17 09:05 axilleas

Yes this is broken on current release.

Run php artisan migrate first, before app:install

livingos avatar May 20 '17 18:05 livingos

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

axilleas avatar May 22 '17 06:05 axilleas

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

this is an implementation of Cachet for Sandstorm.

matbrgz avatar Jun 14 '17 22:06 matbrgz

What version are you using?

jbrooksuk avatar Jun 19 '17 18:06 jbrooksuk

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

anthonymag avatar Jul 20 '17 18:07 anthonymag