I'm using yii2 for a small project, I'm using sqlite to persist the data. So that's where the problem is. Any table I create in sqlite yii2 does not recognize, nor by using the GII to create the models. Interesting is that it plugs into the bank properly. I created the table with a migration.
The PDO for sqlite is active.
yii configuration file:
return [
'class' => 'yii\db\Connection',
'dsn'=>'sqlite:portaltransporte.db',
'username' => '',
'password' => '',
'charset' => 'utf8',
// Schema cache options (for production environment)
//'enableSchemaCache' => true,
//'schemaCacheDuration' => 60,
//'schemaCache' => 'cache',
];
Migration code:
<?php
use yii\db\Migration;
use yii\db\Schema;
class m181207_172303_tabela_contrato extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('contrato',[
'id' =>Schema::TYPE_PK,
'url' =>Schema::TYPE_STRING .'NOT NULL',
'post' =>Schema::TYPE_STRING,
'get' =>Schema::TYPE_STRING,
'put' =>Schema::TYPE_STRING,
'base' =>Schema::TYPE_STRING,
]);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m181207_172303_tabela_contrato cannot be reverted.\n";
$this->dropTable('contrato');
return false;
}
}