Auth migration error
Closed this issue · 4 comments
Hi everyone,
I'm using FuelPHP 1.7.3. I couldn't use simpleauth. After I running php oil r migrate packages=auth
, i'm look following errors.
Uncaught exception Fuel\Core\Database_Exception: SQLSTATE[42000]: Syntax error or access violation: 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 'group int(11) DEFAULT 1 NOT NULL, email varchar(255) NOT NULL, last_login varc' at line 5 with query: "CREATE TABLE IF NOT EXISTS users ( id int(11) NOT NULL AUTO_INCREMENT, username varchar(50) NOT NULL, password varchar(255) NOT NULL, group int(11) DEFAULT 1 NOT NULL, email varchar(255) NOT NULL, last_login varchar(25) NOT NULL, login_hash varchar(255) NOT NULL, profile_fields text NOT NULL, created_at int(11) DEFAULT 0 NOT NULL, updated_at int(11) DEFAULT 0 NOT NULL, PRIMARY KEY idid (id) )DEFAULT CHARACTER SET utf8;"
Any Table is not defined in the database and I'm not defined any migration.
MySQL Version: mysql Ver 14.14 Distrib 5.6.24, for osx10.10 (x86_64) using EditLine wrapper
PHP Version: PHP 5.5.24 (cli)
Your DB config is not complete, it is missing the delimiter needed to escape the column names.
But my migration is running...
My db.php
'default' => array(
'type' => 'pdo',
'connection' => array(
'dsn' => 'mysql:host=localhost;dbname=fuelphp',
'username' => 'username',
'password' => 'password',
'persistent' => false,
'compress' => false,
),
'identifier' => '',
'table_prefix' => '',
'charset' => 'utf8',
'enable_cache' => true,
'profiling' => true,
'readonly' => false,
),
it is missing the delimiter needed to escape the column names.
I didn't understand. What should I do?
Set the identifier to the backtick, which is the delimiter for MySQL. This is described in the docs if I'm not mistaken, and it's also defined like that in the default db config in the core...
İt's worked!
in db.php
'identifier' => '',
to 'identifier' => '`',
Thanks :)