Wednesday, March 30, 2011

Re: Problems running schema update -s

On Mar 30, 11:15 am, Akeda Bagus <ad...@gedex.web.id> wrote:
> >  Comparing Database to Schema...
> >  Error: Missing database table 'cm_foo_bar' for model 'FooBar'

> I assume you're using database configuration more than one and use
> different prefix
> on different configuration. Could you do schema update -s 2 -dry to
> preview the changes?

database1 is postgres and database2 is MySQL. They run on different
servers with separate copies of the app and their own configuration
files. Both use the same prefix (cm_).

schema update -s 2 -dry generates the same error:

Performing a dry run.
Comparing Database to Schema...
Error: Missing database table 'cm_foo_bar' for model 'FooBar'

schema update -f -s 2 -dry generates an alter statement instead of a
create statement. (I'm also not sure where that blank add column
statement is coming from. I just noticed it and haven't looked into it
at all.)

Performing a dry run.
Comparing Database to Schema...

Notice: Undefined index: type in /path/to/trunk/cake/libs/model/
datasources/dbo/dbo_postgres.php on line 887

Notice: Undefined index: in /path/to/trunk/cake/libs/model/
datasources/dbo/dbo_postgres.php on line 887

Warning: Column name or type not defined in schema in /path/to/trunk/
cake/libs/model/datasources/dbo_source.php on line 2720

The following statements will run.
ALTER TABLE "cm_foo_bar"
ADD COLUMN "id" serial NOT NULL,
ADD COLUMN "col1" integer NOT NULL,
ADD COLUMN "col2" varchar(64) DEFAULT NULL,
ADD COLUMN "col3" varchar(32) DEFAULT NULL,
ADD COLUMN "col4" boolean DEFAULT NULL,
ADD COLUMN "created" timestamp ,
ADD COLUMN "modified" timestamp ,
ADD COLUMN "col5" varchar(64) DEFAULT NULL,
ADD COLUMN ,
ADD PRIMARY KEY (id);

CREATE UNIQUE INDEX cm_foo_bar_col1_key ON co_foo_bar ("col1",
"col2")

Thanks,

-Benn-

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: