0
I am using yii2 for a small project, I am using sqlite to persist the data. And here is where the problem is occurring. Any table I create in sqlite yii2 does not recognize, nor does using GII to create models. Interesting is that it connects in the database correctly. I created the table with a Migration.
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',
];
Code of the Migration:
<?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;
}
}