Development

Changeset 5644

You must first sign up to be able to contribute.

Changeset 5644

Show
Ignore:
Timestamp:
10/23/07 18:04:44 (1 year ago)
Author:
francois
Message:

sfPropelAlternativeSchemaPlugin Improved README: wiki-style table, easier example for beginners

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfPropelAlternativeSchemaPlugin/README

    r5579 r5644  
    2929When building the model, the plugin will look for custom YAML files for each schema, following this rule: 
    3030 
    31     Original schema name                     | Custom schema name 
    32     -----------------------------------------|------------------------ 
    33     config/schema.yml                        | schema.custom.yml 
    34     config/foobar_schema.yml                 | foobar_schema.custom.yml 
    35     plugins/myPlugin/config/schema.yml       | myPlugin_schema.custom.yml 
    36     plugins/myPlugin/config/foo_schema.yml   | myPlugin_foo_schema.custom.yml 
     31|| '''Original schema name'''             || '''Custom schema name'''       || 
     32|| config/schema.yml                      || schema.custom.yml              || 
     33|| config/foobar_schema.yml               || foobar_schema.custom.yml       || 
     34|| plugins/myPlugin/config/schema.yml     || myPlugin_schema.custom.yml     || 
     35|| plugins/myPlugin/config/foo_schema.yml || myPlugin_foo_schema.custom.yml || 
    3736 
    3837Custom schemas will be looked for in the application's and plugins' `config/` directories, so a plugin can override another plugin's schema, and there can be more than one customization per schema. 
    3938 
    4039The plugin will merge the two schemas in a smart way, as follows: 
     40 
     41{{{ 
     42# Original schema 
     43################# 
     44propel: 
     45  article: 
     46    _attributes:    { phpName: Article } 
     47    title:          varchar(50) 
     48    user_id:        { type: integer } 
     49    created_at: 
     50 
     51# Custom schema 
     52############### 
     53propel: 
     54  article: 
     55    _attributes:    { phpName: Article, package: foo.bar.lib.model } 
     56    stripped_title: varchar(50) 
     57 
     58# Resulting schema 
     59################## 
     60propel: 
     61  article: 
     62    _attributes:    { phpName: Article, package: foo.bar.lib.model } 
     63    title:          varchar(50) 
     64    user_id:        { type: integer } 
     65    created_at: 
     66    stripped_title: varchar(50) 
     67}}} 
     68 
     69When merging two tables, the plugin will consider the table's `phpName` as a key, and therefore you can change the name of a table in the database, provided that you keep the same `phpName` in the schema. Here is a more complex example: 
    4170 
    4271{{{ 
     
    107136    name:           varchar(50) 
    108137}}} 
    109  
    110 When merging two tables, the plugin will consider the table's `phpName` as a key, and therefore you can change the name of a table in the database, provided that you keep the same `phpName` in the schema. 
    111138 
    112139== New schema syntax ==