isuftin / spotweb

The Unlicense
8 stars 2 forks source link

42000: 1064: You have an error in your SQL syntax #2

Open sanderjo opened 8 years ago

sanderjo commented 8 years ago

On a fresh Ubuntu Server 16.04, I did this:

git clone https://github.com/isuftin/spotweb.git
cd spotweb/
sudo docker-compose up --no-recreate

which eventually results in this error:

spotwebServer_1 | SpotWeb crashed
spotwebServer_1 | 
spotwebServer_1 | Database schema or settings upgrade failed:
spotwebServer_1 |    42000: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IGNORE TABLE spots ADD UNIQUE INDEX idx_spots_1(messageid)' at line 1

Accessing the webserver on http://192.168.1.191/spotweb/, it says:

Notice: Undefined index: xsrfsecret in /var/www/spotweb/lib/services/Settings/Services_Settings_Container.php on line 62

Notice: Undefined index: schemaversion in /var/www/spotweb/lib/services/Settings/Services_Settings_Container.php on line 62 Database schema has been changed. Please run 'upgrade-db.php' from an console window

Should I indeed run 'upgrade-db.php', or should I do something else?

spotwebServer_1 |   Validating tmdb_images(aspect_ratio)
spotwebServer_1 |   Validating tmdb_images(file_path)
spotwebServer_1 |   Validating tmdb_images(height)
spotwebServer_1 |   Validating tmdb_images(width)
spotwebServer_1 |   Validating index idx_spots_1
spotwebServer_1 |       Adding index idx_spots_1
spotwebServer_1 | 
spotwebServer_1 | 
spotwebServer_1 | SpotWeb crashed
spotwebServer_1 | 
spotwebServer_1 | Database schema or settings upgrade failed:
spotwebServer_1 |    42000: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IGNORE TABLE spots ADD UNIQUE INDEX idx_spots_1(messageid)' at line 1
spotwebServer_1 | 
spotwebServer_1 | 
spotwebServer_1 | #0 /var/www/spotweb/lib/dbstruct/SpotStruct_mysql.php(99): dbeng_pdo->rawExec('ALTER IGNORE TA...')
spotwebServer_1 | #1 /var/www/spotweb/lib/dbstruct/SpotStruct_abs.php(131): SpotStruct_mysql->addIndex('idx_spots_1', 'UNIQUE', 'spots', Array)
spotwebServer_1 | #2 /var/www/spotweb/lib/dbstruct/SpotStruct_abs.php(778): SpotStruct_abs->validateIndex('idx_spots_1', 'UNIQUE', 'spots', Array)
spotwebServer_1 | #3 /var/www/spotweb/lib/services/Upgrade/Services_Upgrade_Base.php(42): SpotStruct_abs->updateSchema()
spotwebServer_1 | #4 /var/www/spotweb/upgrade-db.php(44): Services_Upgrade_Base->database()
spotwebServer_1 | #5 {main}spotweb_spotwebServer_1 exited with code 0
sammcf commented 8 years ago

I had this problem, too. It's reported on the Spotweb repo and has been closed with a fix but even though tagged as "deployed," the patch doesn't seem to have actually been merged into media or master yet. In the meantime, I got around this by:

docker cp <containerid>:var/www/spotweb/lib/dstruct/SpotStruct_mysql.php SpotStruct_mysql.php

and manually applying the fix from the above commit, then just docker cping the file back in. Bit of pain, but works perfectly well.

mrginogit commented 8 years ago

@sammcf I'm having trouble getting that command to work.

I first run sudo docker-compose up --no-recreate until getting the same error as the OP I then do docker ps to get the container ID of the DB ("isuftin/spotweb_db:latest") I then add that container ID to your cp command sudo docker cp ##########:var/www/spotweb/lib/dstruct/SpotStruct_mysql.php SpotStruct_mysql.php But when I run it, I get: Error response from daemon: lstat /var/lib/docker/aufs/mnt/a71b846e3a79b9ef6261355bc28f5f969104aef431a68fabd9a2097575eafc45/var/www/spotweb/lib/dstruct/SpotStruct_mysql.php: no such file or directory

Am I missing something?

mrginogit commented 8 years ago

Figured it out - there is a typo in the above docker cp command, missing the b in dbstruct. should be:

docker cp <containerid>:var/www/spotweb/lib/dbstruct/SpotStruct_mysql.php SpotStruct_mysql.php