silverstripe / silverstripe-sqlite3

SQLite3 DB Adapter for Silverstripe
BSD 3-Clause "New" or "Revised" License
8 stars 19 forks source link

/dev/build Failes on VACUUM #31

Closed geekdenz closed 6 years ago

geekdenz commented 7 years ago

/dev/build failed for me on the VACUUM statement. Changing this line: https://github.com/silverstripe/silverstripe-sqlite3/blob/1.4/code/SQLite3SchemaManager.php#L29

to

    public static $vacuum = false;

fixes it for me.

dhensby commented 7 years ago

Which version of the CMS are you running against?

geekdenz commented 7 years ago

I ran

composer create-project silverstripe/installer /path/to/project 3.5.3

which is on the Download page: https://www.silverstripe.org/download/

So, 3.5.3.

geekdenz commented 7 years ago

I installed on Ubuntu 16.04.2 with the latest PHP 5.6 version available through the PPA.

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6 php5.6-sqlite3
geekdenz commented 7 years ago

SQLite as a backend DB is actually really good for small sites, testing fixtures or if you want to show something quickly and version the DB easily as well. The site runs pretty fast as well, so unless one has a high traffic writing DB site, I think SQLite is quite good and therefore important.

kinglozzer commented 7 years ago

Do you get any further information when it fails - an error message explaining why or anything? Which version of sqlite3 are you using?

geekdenz commented 7 years ago

I noticed that there were 2 files. Sorry doing this from plain memory as I was doing this on another machine.

something like database.sqlite database.sqlite;utf-8

Yes, a semi colon in the file name and the first file was 0 bytes size which surprised me.

There was just a "Server Error" as far as I recall. No error in the Apache log files. The script seems to have failed on

VACUUM

and when I turned it off, it succeeded.

kinglozzer commented 7 years ago

Yes those filenames look correct (semi-colon is expected too, though it is strange admittedly). Do you have dev mode enabled in SilverStripe?

geekdenz commented 7 years ago

Dev mode is probably on, yes. At least I didn't turn it off. /dev/build wouldn't work with it off, would it?

dhensby commented 7 years ago

/dev/build wouldn't work with it off, would it?

it would if you're logged in. dev mode is not on by default - you'd have to turn it on in your _ss_environment.php file or the config layer.

geekdenz commented 7 years ago

So, do you think turning it on would change anything? I believe I was logged in while trying /dev/build.

kinglozzer commented 7 years ago

Hopefully it will display the actual error message. Could you try that? Either:

// _ss_environment.php
define('SS_ENVIRONMENT_TYPE', 'dev');

or

# config.yml
Director:
  environment_type: 'dev'
geekdenz commented 7 years ago

OK, I went through setting up _ss_environment.php and now it doesn't fail on the VACUUM. I suspect I configured something wrong and I think it was the DB name, although if memory serves me right, it was the default that SilverStripe gave me on install.php. Maybe try without _ss_environment.

maxime-rainville commented 6 years ago

Looks like @geekdenz resolve fix is own issue.