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

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

Closed
ccosentino opened this Issue Jul 21, 2016 · 22 comments

Comments

@ccosentino

ccosentino commented Jul 21, 2016

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

  • I am running the latest release version of Cachet.
  • I am running at least PHP 5.5.9. You can check this by running php -v.
  • 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
@jbrooksuk

This comment has been minimized.

Show comment
Hide comment
@jbrooksuk

jbrooksuk Jul 22, 2016

Member

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

Member

jbrooksuk commented Jul 22, 2016

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

@ccosentino

This comment has been minimized.

Show comment
Hide comment
@ccosentino

ccosentino Jul 22, 2016

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 commented Jul 22, 2016

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)

@GrahamCampbell

This comment has been minimized.

Show comment
Hide comment
@GrahamCampbell

GrahamCampbell Jul 22, 2016

Member

Please run:

cat VERSION
php --version
Member

GrahamCampbell commented Jul 22, 2016

Please run:

cat VERSION
php --version
@ccosentino

This comment has been minimized.

Show comment
Hide comment
@ccosentino

ccosentino Jul 22, 2016

$ 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 commented Jul 22, 2016

$ 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

This comment has been minimized.

Show comment
Hide comment
@ccosentino

ccosentino Jul 22, 2016

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 commented Jul 22, 2016

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

@GrahamCampbell GrahamCampbell added this to the V2.3.8 milestone Jul 25, 2016

@jbrooksuk

This comment has been minimized.

Show comment
Hide comment
@jbrooksuk

jbrooksuk Jul 29, 2016

Member

@CachetHQ/owners any clue on this?

Member

jbrooksuk commented Jul 29, 2016

@CachetHQ/owners any clue on this?

@jbrooksuk jbrooksuk changed the title from Fresh install V2.6.0 SQlite - SQLSTATE[HY000]: General error: 17 database schema has changed to SQLSTATE[HY000]: General error: 17 database schema has changed Jul 29, 2016

@jbrooksuk jbrooksuk added the Bug label Jul 29, 2016

@jbrooksuk

This comment has been minimized.

Show comment
Hide comment
@jbrooksuk

jbrooksuk Jul 29, 2016

Member

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

Member

jbrooksuk commented Jul 29, 2016

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

@ccosentino

This comment has been minimized.

Show comment
Hide comment
@ccosentino

ccosentino Jul 29, 2016

I moved over to MySQL to work around this.

ccosentino commented Jul 29, 2016

I moved over to MySQL to work around this.

@jbrooksuk

This comment has been minimized.

Show comment
Hide comment
@jbrooksuk

jbrooksuk Jul 29, 2016

Member

I'm glad you're up and running.

We'll still continue to solve this issue though 👍

Member

jbrooksuk commented Jul 29, 2016

I'm glad you're up and running.

We'll still continue to solve this issue though 👍

@axilleas

This comment has been minimized.

Show comment
Hide comment
@axilleas

axilleas Jul 31, 2016

Contributor

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.

Contributor

axilleas commented Jul 31, 2016

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.

@jbrooksuk

This comment has been minimized.

Show comment
Hide comment
@jbrooksuk

jbrooksuk Aug 1, 2016

Member

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

Member

jbrooksuk commented Aug 1, 2016

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

@axilleas

This comment has been minimized.

Show comment
Hide comment
@axilleas

axilleas Aug 1, 2016

Contributor

Awesome, thanks :)

Contributor

axilleas commented Aug 1, 2016

Awesome, thanks :)

@jbrooksuk

This comment has been minimized.

Show comment
Hide comment
@jbrooksuk

jbrooksuk Aug 2, 2016

Member

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

Member

jbrooksuk commented Aug 2, 2016

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

@jbrooksuk jbrooksuk self-assigned this Aug 2, 2016

@jbrooksuk jbrooksuk added the Blocker label Aug 2, 2016

@GrahamCampbell GrahamCampbell modified the milestones: V2.4.0, V2.3.9 Aug 7, 2016

@jbrooksuk

This comment has been minimized.

Show comment
Hide comment
@jbrooksuk

jbrooksuk Aug 8, 2016

Member

This is now fixed.

Member

jbrooksuk commented Aug 8, 2016

This is now fixed.

@axilleas

This comment has been minimized.

Show comment
Hide comment
@axilleas

axilleas May 20, 2017

Contributor

@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
Contributor

axilleas commented May 20, 2017

@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
@livingos

This comment has been minimized.

Show comment
Hide comment
@livingos

livingos May 20, 2017

Yes this is broken on current release.

Run php artisan migrate first, before app:install

livingos commented May 20, 2017

Yes this is broken on current release.

Run php artisan migrate first, before app:install

@axilleas

This comment has been minimized.

Show comment
Hide comment
@axilleas

axilleas May 22, 2017

Contributor

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

Contributor

axilleas commented May 22, 2017

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

@MatheusRV

This comment has been minimized.

Show comment
Hide comment
@MatheusRV

MatheusRV Jun 14, 2017

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

this is an implementation of Cachet for Sandstorm.

MatheusRV commented Jun 14, 2017

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

this is an implementation of Cachet for Sandstorm.

@jbrooksuk

This comment has been minimized.

Show comment
Hide comment
@jbrooksuk

jbrooksuk Jun 19, 2017

Member

What version are you using?

Member

jbrooksuk commented Jun 19, 2017

What version are you using?

@anthonymag

This comment has been minimized.

Show comment
Hide comment
@anthonymag

anthonymag Jul 20, 2017

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 commented Jul 20, 2017

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

@jbrooksuk

This comment has been minimized.

Show comment
Hide comment
@jbrooksuk

jbrooksuk Jul 25, 2017

Member

@ConnorVG did you figure this out? 🤔

I wonder if @taylorotwell has seen this issue previously?

Member

jbrooksuk commented Jul 25, 2017

@ConnorVG did you figure this out? 🤔

I wonder if @taylorotwell has seen this issue previously?

@veryfoodverygood

This comment has been minimized.

Show comment
Hide comment
@veryfoodverygood

veryfoodverygood Aug 3, 2017

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

veryfoodverygood commented Aug 3, 2017

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment