Search code examples
phpmysqlsqlormkohana

KOHANA: ORM + MySQL won't find table


For some reason I see a Kohana exeption Exception [ 0 ]: The "users" table doesn't exist. Make sure to import the tables.sql file.
What I need to do?

19 {
20  ORM::factory('user');
21 }
22 catch(exception $e)
23 {
24  throw new Exception('The "users" table doesn\'t exist. Make sure to import the tables.sql file');
25 }
26 
27 Route::set('Kohanauserauth', user::path().'(/<action>(/<id>))')
28  -> defaults(array(
29      'controller' => 'Kohanauserauth'

Solution

  • I would imagine you've enabled the "Auth" module and not set up the database tables beforehand. Auth requires a table called "users". The schema for the tables is included in the module folders. If you're not using the Auth module then disable it in your bootstrap file.

    You've not said what version of Kohana you're using so I'll assume 3.3, so I would advise reading this first: http://kohanaframework.org/3.3/guide/auth/

    If you're new to Kohana and not willing to invest time in reading the limited documentation, then I would advise using a different framework, because Kohana takes quite a long time to learn.