Skip Menu |

This queue is for tickets about the Catalyst-Manual CPAN distribution.

Report information
The Basics
Id: 45576
Status: resolved
Priority: 0/
Queue: Catalyst-Manual

People
Owner: HKCLARK [...] cpan.org
Requestors: phi1ipp [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: postgresql migration - commands to call for creating new schema etc.
Date: Thu, 30 Apr 2009 01:11:12 +0000 (GMT)
To: bug-Catalyst-Manual [...] rt.cpan.org
From: Philipp Wesche <phi1ipp [...] yahoo.com>
The appendix of the manual explains some of the migration process from sqlite to postgresql. However, that section is incomplete. Currently to be found at http://search.cpan.org/~hkclark/Catalyst-Manual-5.7020/lib/Catalyst/Manual/Tutorial/Appendices.pod#PostgreSQL it fizzles out at the vague advice that " # After the steps where you: edit lib/MyApp.pm, create lib/MyAppDB.pm, create lib/MyAppDB/Book.pm, create lib/MyAppDB/Author.pm, create lib/MyAppDB/BookAuthor.pm # Generate the model using the Catalyst "_create.pl" script: script/myapp_create.pl model MyAppDB DBIC::Schema MyAppDB 'dbi:Pg:dbname=catappdb' 'catappuser' 'catalyst' '{ AutoCommit => 1 }' " It doesn't state how to edit or create those files. What seems to have worked for me is to perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:./lib -e 'make_schema_at("MyApp::Schema", { debug => 1, db_schema => "myapp", use_namespaces => 1, components => ["InflateColumn::DateTime"] }, ["dbi:Pg:host=localhost;dbname=catappdb", "catappuser", "password" ])' Then copy-paste any specific relationships that you've previously defined in the files found in lib/MyApp/Schema into the new files in lib/MyAppDB/Result, then: replace 'MyApp::Schema' 'MyAppDB::Result' -- lib/MyAppDB/Result/* perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:./lib -e 'make_schema_at("MyApp::Schema", { debug => 1, db_schema => "myapp", use_namespaces => 1, components => ["InflateColumn::DateTime"] }, ["dbi:Pg:host=localhost;dbname=catappdb", "catappuser", "password" ])' perl script/myapp_create.pl model DB DBIC::Schema MyAppDB create=static components=TimeStamp 'dbi:Pg:dbname=catappdb' 'catappuser' 'catalyst' '{ AutoCommit => 1 }' Then test that everything worked, preferably by calling: DBIC_TRACE=1 perl script/myapp_server.pl and verifying that all relationships work on-site as defined in schema, as the output will not indicate this. Someone may also know how to do the job of make_schema_at by way of myapp_create, in a way that schema files end up in just one location. Anyway, someone should verify that this order of commands actually works before then hopefully including it in the manual. I know there are different versions of the replace utility floating around, mine is the mysql flavor. Creating the test environment should be easy using the cpan download of the tutorial, e.g. http://search.cpan.org/~mramberg/Task-Catalyst-Tutorial-0.06/lib/Task/Catalyst/Tutorial.pm Some of this may also apply to the mysql section on the same page. Phil
I believe all of this should be addresses in this rev: http://dev.catalystframework.org/svnweb/Catalyst/revision/?rev=9998