[sql]
CREATE SEQUENCE usuario_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
CREATE TABLE "tb_usuario" (
“id” int4 DEFAULT nextval(‘usuario_id_seq’::regclass) NOT NULL,
"email" varchar(80) NOT NULL,
"senha" varchar(100) NOT NULL,
"ativo" int2 DEFAULT 0 NOT NULL,
"created_at" timestamp(6) DEFAULT now() NOT NULL,
"updated_at" timestamp(6) DEFAULT now() NOT NULL
)
WITH (OIDS=FALSE);
[/sql]
//config/main.php
'db' => array(
'connectionString' => 'pgsql:host=localhost;dbname=test',
'emulatePrepare' => TRUE,
'username' => 'user',
'password' => 'pass',
'charset' => 'utf8',
'enableProfiling' => TRUE,
'enableParamLogging' => TRUE,
'tablePrefix' => 'tb_',
"initSQLs" => array("SET search_path TO dev") # não funciona
),
class Usuario extends CActiveRecord
{
public static function model($className = __CLASS__)
{
return parent::model($className);
}
public function tableName()
{
# só detecta a tabela usuario no schema dev desta forma
return "dev.tb_usuario";
}
}
Como faço para que o Yii detecte a tabela tb_usuario sem essa gambiarra?