create model using shell with schema

Dear All,

Does anyone know how to create model of table using schema ?

I hava a table with schema ex : eng.material

schema name : eng.

table name : material

my DB is postgreSql.

I try

>>model eng.material, but error message shown.

Anyone can help me ?

Thanks,

Regards.

JN

We use this way with Oracle. I don’t know if Postgres driver have it implemented.

Which error did you get?

Dear,

This is the error :

Warning: the table ‘material’ does not exist in the database.

generate material.php

I know, there is a table material under eng schema,

but it seems command model is only for public schema.

I try model command with other table under public schema, it works succesfully.

I don’t know how to create a model of a table under other schema, not in public schema.

Thanks,

Regards,

JN

As I said, I don’t know if pg supports multiple schema.

When I developed Oracle driver for AR, I remember to analyse postgres driver to see how did it deals with multiple schemas and I didn’t have seen this. But, as I don’t know too much about pg, I’m not sure.

Dear Ricardo,

Thanks for your reply, this is not about pg doesn’t support schema, pg does, but yii shell model command doesn’t support create model for table pg using schema.

I hava solved this problem.

To make a model table with schema using pg as db.

  1. go to shell,

  2. type model <name table>,

  3. go to the model file, then edit manually.


	

        public function tableName()

	{

		return 'eng.material';                

	}



also add this manually,


	

	public function rules()

	{ your rules array

        }



and this.


	

	public function attributeLabels()

	{ your attributeLabels array}



So, I create the model using shell just to get the model template file, then crack it manually.

Thanks anyway !

Regards,

JN

I see. However, it still seems to me that pg driver have to be fixed about this (yiic model support)

You can however "play" with

alter table table_name SET SCHEMA

for the purpose of creating valid Yii models.