Vitalii Zurian
Vitalii Zurian

Reputation: 17976

Is it possible to have test_schema.xml in Propel 1.6?

I am using Symfony-2.0 and Propel 1.6.

For testing purposes I'd like to have separate schema file. The reason is that with my current schema it is impossible to load dumped fixtures, because process fails due PK and autoincrement:

app/console propel:fixtures:load --env=test
Use connection named default in test environment.
No SQL fixtures found.
No XML fixtures found.


  [Propel] Exception                                                 

  Cannot insert a value for auto-increment primary key (article.ID)

If I could define test_schema.xml I'd generate models from it without autoIncrement="true" property and then fixtures would be loaded.


How can I force Propel to use test_schema.xml in test environment?

Or may be there is another way how to load fixtures correctly?

Upvotes: 0

Views: 271

Answers (1)

Carlos Granados
Carlos Granados

Reputation: 11351

You can use the propel propel.schema.dir and propel.default.schema.basename build properties to specify where the schema file is located and its name:

# app/config/config_test.yml
propel:
    build_properties:
# The directory where Propel expects to find your `schema.xml` file.
        propel.schema.dir = //wherever
# The schema base name
        propel.default.schema.basename = schema

Upvotes: 1

Related Questions