Search code examples
schemareversepropel

Propel ORM - how do I specify tables to reverse engineer?


I have a database with a few dozen tables. My app deals with just one of those tables. I'd like propel to generate the schema just for that table. Is there a way I can specify the table(s) in build.properties?


Solution

  • A solution could be to write your own schema parser that ignores certain tables. These tables to exclude could be read from a config file or so.

    Take a look at the MysqlSchemaParser.php to get an idea of how such a parser works. You could extend such an existing parser and just override the parse() method. When tables are added, you would check them for exclusion/inclusion and only add them if they meet your subset criteria.

    How to create custom propel tasks is described in the Propel cookbook.

    Instead of invoking propel-gen reverse you would then invoke your customized reverse engineering task.

    If done neatly, I'd find it worth being added as a contribution to the Propel project and you'd definitely deserve fame for that! :-)