2

I'm having trouble finding it in the CPAN documentation -- is there a way to create a table (IF NOT EXISTS) from manually-entered Rose::DB::Object metadata?

I'm using SQLite as an engine, if it happens to matter. Thanks!

John Siracusa
  • 14,971
  • 7
  • 42
  • 54
cdleary
  • 69,512
  • 53
  • 163
  • 191

1 Answers1

4

While it is possible to create a Rose::DB::Object class (as a .pm file on disk or just in memory) from an existing SQL schema using Rose::DB::Object::Loader, there is currently no built-in way to do the reverse: generate an SQL table definition from a Rose::DB::Object class definition.

To do such a thing, I suggest looking into using SQL::Translator. All of the Rose::DB::Object metadata is readily available. It'd just be a matter of adapting it to suit SQL::Translator's requirements. If you'd like more guidance or some help doing this, I suggest asking around on the RDBO mailing list.

John Siracusa
  • 14,971
  • 7
  • 42
  • 54