In testing the farmOS Docker branch (https://github.com/farmOS/farmOS/issues/15), I'm finding that farmOS cannot be installed on an SQLite database. It works fine on a MySQL database, though. PostgreSQL has yet to be tested.

The following error always occurs during installation on SQLite:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: http://172.17.0.2/install.php?profile=farm&locale=en&id=1&op=do StatusText: Service unavailable (with message) ResponseText: PDOException: SQLSTATE[HY000]: General error: 1 no such table: farm_asset_type: SELECT base.id AS id, base.type AS type, base.label AS label, base.status AS status, base.module AS module FROM {farm_asset_type} base; Array ( ) in EntityAPIController->query() (line 187 of /var/www/html/profiles/farm/modules/contrib/entity/includes/entity.controller.inc).

The fact that it says "General error: 1 no such table: farm_asset_type" suggests that maybe the farm_asset module's database tables are not compatible with SQLite. That would be a good place to start.

Comments

m.stenta created an issue. See original summary.

m.stenta’s picture

Update: I'm honing in on this a little more.

I confirmed that it is definitely the farm_asset module causing this issue.

I commented out all the contrib and farm dependencies in the farmOS installation profile's farm.info file:

; Contrib
;dependencies[] = exif_orientation
;dependencies[] = libraries_cdn
;dependencies[] = jquery_update
;dependencies[] = module_filter
;dependencies[] = navbar
;dependencies[] = pathauto_entity
;dependencies[] = restws

; Farm
;dependencies[] = farm_access
;dependencies[] = farm_admin
;dependencies[] = farm_area
;dependencies[] = farm_asset
;dependencies[] = farm_fields
;dependencies[] = farm_log
;dependencies[] = farm_map
;dependencies[] = farm_quantity
;dependencies[] = farm_taxonomy

I also had to remove all the code from farm.install - because that depended on some of the contrib stuff.

This allowed me to complete install.php without the error. Then I went to /admin/modules and enabled JUST the farm_asset module (along with it's dependencies automatically).

That gave me the following error:

Additional uncaught exception thrown while handling exception.

Original

PDOException: SQLSTATE[HY000]: General error: 1 there is already an index named farm_asset_type: CREATE TABLE {farm_asset_type} ( id INTEGER PRIMARY KEY AUTOINCREMENT CHECK (id>= 0), type VARCHAR(32) NOT NULL, label VARCHAR(255) NOT NULL DEFAULT '', status INTEGER NOT NULL DEFAULT 1, module VARCHAR(255) NULL DEFAULT NULL ); ; Array ( ) in db_create_table() (line 2776 of /var/www/html/includes/database/database.inc).

Additional

PDOException: SQLSTATE[HY000]: General error: 1 no such table: farm_asset_type: SELECT base.id AS id, base.type AS type, base.label AS label, base.status AS status, base.module AS module FROM {farm_asset_type} base; Array ( ) in EntityAPIController->query() (line 187 of /var/www/html/profiles/farm/modules/contrib/entity/includes/entity.controller.inc).
m.stenta’s picture

Ah ha! I think I understand now...

SQLite handles database indexes differently, so there appears to be a conflict with the "type" index created for the {farm_asset} table, and the "type" index created for the "farm_asset_type" table.

A little searching found these similar issues in other Drupal modules:

#1876872: SQLite error: "there is already an index named entityform_type"

#1941448: Message module fails to install with SQLite (TABLE and INDEX both named "message_type")

It looks like this will be easy to solve simply by renaming one of the database indexes.

m.stenta’s picture

Status: Active » Fixed

I pushed commits to both farm_asset and log to fix the same issue in both modules.

After that, I discovered there is an outstanding issue with the Pathauto module that causes a PHP maximum execution time error: #2582655: Pathauto 7.x-1.3 causes timeouts with SQLite

So I included that patch in the farmOS makefile, while we wait for the new version of Pathauto to be released.

m.stenta’s picture