Hi, i'm trying to build new application with fuel 1.4. When i try to migrate with oil, there is an error message "No Database Selected". This also happen when I try to create user via oil command line. I have set the database config in /fuel/app/config/development and already make the database. Is there something I've missed, or this is a bug?? +
Hi, I have solved this problem. Here is the "log" of what I have done.
1. When I create a new app via command line using oil create /mysite in /var/www, it was a success.
2. But when I navigate to localhost/mysite/public/index.php, I redirected to an 404 page.
3. So I go to /fuel/core/config and fill the 'index_file' with 'index.php'.
4. I refreshed the page and it worked.
5. When I using oil to generate a model
oil g model users username:varchar[50] password:string group:int email:string last_login:int login_hash:string profile_fields:text
6. An error occured
Error - Class 'Clio' not found in PKGPATH/oil/classes/generate.php on line 238
7. I change the 'Clio' to 'Cli' at line 238 and tried again to generate a model, and it was success
8. Now trying to migrate using oil refine migrate, but an error occured
1046 - No database selected [ CREATE TABLE IF NOT EXISTS `migration` (
`type` varchar(25) NOT NULL,
`name` varchar(50) NOT NULL,
`migration` varchar(100) DEFAULT '' NOT NULL
) DEFAULT CHARACTER SET utf8; ] in COREPATH/classes/database/mysqli/connection.php on line 243
9. I fill the parameter of msqli config at /fuel/core/config/db
10. I tried to run the migrate once again, and it was a success
11. I use the oil console to create a user and it was success
By the way, I didn't have to fill the mysqli config when I use FuelPHP 1.3 to define the database. Just change the 'dbname' at /fuel/app/config/development/db and it all worked just fine. +
You should not modify config/db.php, unless you're changing global parameters. Anything in development will overwrite what you have defined globally. Both are by default configured for PDO, not for MySQLi, so you have changed more then only the db name. Maybe you should post both config files here (remove the password) so we can have a look.
Absolutely nothing has changed in 1.4 compared to 1.3.
* See the individual environment DB configs for specific config information.
*/
return array(
);
And here is my fuel/core/config/db
/**
* Base MySQLi config
*/
'default' => array(
'type' => 'mysqli',
'connection' => array(
'hostname' => 'localhost',
'username' => 'root',
'password' => 'mypassword',
'database' => 'sic_perpus',
'persistent' => false,
),
'identifier' => '`',
'table_prefix' => '',
'charset' => 'utf8',
'enable_cache' => true,
'profiling' => false,
),
I just modify that setting, nothing else. In FuelPHP version 1.3, the db.php file inside fuel/app/config/ is not empty, there lies the PDO type connection setting. Should I fill this with the setting like in version 1.3?? +
Issue seems to be related to the default db.php file in fuel/core/config, which has two default entries for both PDO and MySQLi, the last one overwriting the first one.
Remove the MySQLi entry in there to fix the issue.