That explains it. Problem solved. Thank you. On Jun 19, 2010, at 9:20 AM, Svetoslav Shterev wrote:
> build-sql does not touch the schema at all. It generates sql from the > *models*. You need to generate new models from the schema(build-model) > first, and then regenerate sql. > > On Jun 19, 2:33 pm, Ryan Walker <n...@witb.org> wrote: >> I hope this isn't a double post. I tried to post this yesterday and it did >> not seem to go through to the list. >> >> I am new to symfony and doctrine. My co-workers designed a database >> structure, and subsequently modified it directly. I am attempting to bring >> our symfony/doctrine model back into sync with it. >> >> One of the tables in the schema is giving me trouble. Doctrine was adding an >> `id` column to it when I performed a doctrine:build-schema. I realized that >> the primary key of the table was not marked as such. So I fixed that, and >> now doctrine:build-schema kicks out a reasonable schema.yml file. >> >> However, when I run doctrine:build-sql, it adds in an `id` column again and >> changes the primary key from `statusid` to `id,statusid`. >> >> Here's what I have in schema.yml for this particular table: >> >> UsersStatus: >> connection: doctrine >> tableName: users_status >> columns: >> statusid: >> type: integer(11) >> fixed: false >> unsigned: false >> primary: true >> autoincrement: true >> status: >> type: string(20) >> fixed: false >> unsigned: false >> primary: false >> default: '' >> notnull: true >> autoincrement: false >> relations: >> Users: >> local: statusid >> foreign: statusid >> type: many >> >> What I expect doctrine to produce for SQL is: >> CREATE TABLE users_status (statusid BIGINT AUTO_INCREMENT, status >> VARCHAR(20) DEFAULT '' NOT NULL, PRIMARY KEY(statusid)) ENGINE = INNODB; >> >> but instead, I get this: >> CREATE TABLE users_status (id BIGINT AUTO_INCREMENT, statusid BIGINT >> AUTO_INCREMENT, status VARCHAR(20) DEFAULT '' NOT NULL, PRIMARY KEY(id, >> statusid)) ENGINE = INNODB; >> >> Now here's where things get completely bizarre. Hopefully this will be the >> key to someone. >> >> I can remove my schema.yml and schema.sql files and clear cache, then rerun >> doctrine:build-sql and it will still generate the same SQL file! If I'm >> reading the documentation correctly, it should fail when schema.yml is >> missing. So, if it's not using config/doctrine/schema.yml, then where is it >> getting the schema definition? >> >> Any help would be appreciated. >> >> Ryan > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en