Skip to content

rake db:test:prepare fails loading schema (generated by MySql ) using sqlite3 engine because of specific options passed in schema (MySql specific) #228

Open
@Kareem-Emad

Description

@Kareem-Emad

sqlite3 --version
3.25.2
mysql --version
mysql Ver 14.14 Distrib 5.7.25

Error Log:

bin/bundle exec rake db:test:prepare
rake aborted!
ActiveRecord::StatementInvalid: SQLite3::SQLException: near "ENGINE": syntax error: CREATE TABLE "app_dependencies" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "app_id" integer, "dependency_id" integer, "created_at" datetime, "updated_at" datetime) ENGINE=InnoDB DEFAULT CHARSET=utf8
/home/kareem/Projects/platform/db/schema.rb:15:in block in <top (required)>' /home/kareem/Projects/platform/db/schema.rb:13:in <top (required)>'
bin/bundle:104:in load' bin/bundle:104:in

'

Caused by:
SQLite3::SQLException: near "ENGINE": syntax error
/home/kareem/Projects/platform/db/schema.rb:15:in block in <top (required)>' /home/kareem/Projects/platform/db/schema.rb:13:in <top (required)>'
bin/bundle:104:in load' bin/bundle:104:in

'
Tasks: TOP => db:test:load_schema
(See full trace by running task with --trace)
Makefile:36: recipe for target 'run-tests' failed
make: *** [run-tests] Error 1

I can get around this by removing options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" from the schema file before running make run-tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions