[Dbix-class] DBIC Schema to DDL
rabbit+dbic at rabbit.us
Wed Feb 10 11:39:23 GMT 2010
Dave Cross wrote:
> I'm revisiting an old project that I last worked on a year ago. I have
> the DBIx::Class schema files, but the database itself disappeared in a
> server move and I (stupidly) didn't put the DDL into git.
> Is there a way to take a set of DBIx::Class schema classes and
> (re-)generate the DDL that was originally used to generate the classes?
> I know I can manually create the DDL by looking at the classes. And in
> this case, that might well be the quickest solution. But in case I make
> the same mistake again I'd like to know if DBIx::Class has a way to do this.
> This is for MySQL - I suppose that makes a difference.
This is the method used by $schema->deploy(), which will generate the database
for you. As Ian already mentioned a lot of use chose to maintain the schema
in DBIC/perl only, and use ::Versioned to reflect changes in the database.
More information about the DBIx-Class