[Catalyst] Best practice for setting up database in a complex project?

Lee Aylward lee at laylward.com
Fri Jul 16 18:56:55 GMT 2010


On 07/16/2010 01:01 PM, Matija Grabnar wrote:
> I was wondering what the experienced Catalyst developers use to set up 
> a database in a project.
> Do you write the database definition mysql/postgresql format, and then 
> dump schema to get the Perl classes, or do you write Perl class 
> definitions and use something else to output the table creation 
> statements for the
> database of your choice?
>
> And what do you do when the structure of the database changes (new 
> tables, new columns, new indexes or foreign keys) - do you use a DB 
> versioning thing, or do you do it by hand? If you do use a DB 
> versioning tool,
> which do you recommend?
>

I typically write my schema in perl and then use the DBIC tools to 
export SQL for the databases I plan to use. I find this useful because I 
can generate SQLite SQL for local development, as well as 
MySQL/Postresql for production. You can also get schema versioning this 
way by generating diffs between each revision. The `dbicadmin` tool was 
able to do all of this for me last time I tried.

-- 
Lee



More information about the Catalyst mailing list