Thanks for your reply. Perhaps I was a bit vague, so here is some more detail.
No, the JSON data does not contain the relationships. Only table names, and I infer the foreign keys.
Consider the following SQL of two tables where one is referencing the other's PK:
CREATE TABLE MyappType ( Id INTEGER NOT NULL UNIQUE # ... ); CREATE TABLE AvailableMyapp ( MyappTypeId INTEGER NOT NULL, FOREIGN KEY(MyappTypeId) REFERENCES MyappType(Id) # ... );
Using:
DBIx::Class::Schema::Loader::make_schema_at( 'Myapps::Model::Schema', skip_load_external => 1, naming => { monikers => 'preserve', #relationships => 'current', column_accessors => 'preserve', }, );
creates following perl in file : Model::Schema::Result::AvailableMyapp
... __PACKAGE__->has_many( "available_myapps", "Myapps::Model::Schema::Result::AvailableMyapp", { "foreign.MyappTypeId" => "self.Id", }, { "cascade_copy" => "0", "cascade_delete" => "0", }, );
and this perl in file 'Model/Schema/Result/AvailableMyapp.pm':
... __PACKAGE__->belongs_to( "myapp_type", "Myapps::Model::Schema::Result::MyappType", { "Id" => "MyappTypeId", }, { "is_deferrable" => "0", "on_delete" => "NO ACTION", "on_update" => "NO ACTION", }, );
My problem is with the relationship names "available_myapps" and "myapp_type". I don't want the plural in the first one and I don't want to break the camel type for either.
In reply to Re^2: DBIx::Class : stop changing table, column, relationship names
by bliako
in thread DBIx::Class : stop changing table, column, relationship names
by bliako
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |