[Koha-devel] The schema of DBIx::Class is not up-to-date

Yohann Dufour yohann.dufour at biblibre.com
Mon Jul 7 16:10:40 CEST 2014


Good afternoon,

As you know, I'm working on DBIx::Class, and I realized that the 
DBIx::Class schema (in Koha/Schema/) is not up-to-date with the current 
database structure (installer/data/mysql/kohastructure.sql) which is 
really used by the modules. The last update of the DBIx::Class schema 
was the 2013-10-14, and some changes has been done since this day.

Thus, it is problematic to use DBIx::Class if some differences exist.
What do you think about updating the DBIx::Class in order to link it 
with the current database schema and trying to find a way to update 
automatically the DBIx::Class schema at each change in the database 
structure.

I joined with this email the list of the differences between the 
DBIx::Class schema and the current database schema.


Yohann
-------------- section suivante --------------
diff -r /home/yohann/koha/Koha/Schema/Result/Accountline.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Accountline.pm
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
>     on_delete     => "SET NULL",
>     on_update     => "SET NULL",
diff -r /home/yohann/koha/Koha/Schema/Result/Aqbasket.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Aqbasket.pm
<     on_delete     => "CASCADE",
>     on_delete     => "RESTRICT",
<   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
>   { is_deferrable => 1, on_delete => "RESTRICT", on_update => "CASCADE" },
<     on_delete     => "CASCADE",
>     on_delete     => "SET NULL",
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
>     on_delete     => "RESTRICT",
>     on_update     => "RESTRICT",
diff -r /home/yohann/koha/Koha/Schema/Result/Aqinvoice.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Aqinvoice.pm
<     on_delete     => "CASCADE",
>     on_delete     => "SET NULL",
diff -r /home/yohann/koha/Koha/Schema/Result/Aqorder.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Aqorder.pm
<     on_delete     => "CASCADE",
>     on_delete     => "SET NULL",
<     on_delete     => "CASCADE",
>     on_delete     => "SET NULL",
diff -r /home/yohann/koha/Koha/Schema/Result/AqordersTransfer.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/AqordersTransfer.pm
<     on_delete     => "CASCADE",
>     on_delete     => "SET NULL",
<     on_delete     => "CASCADE",
>     on_delete     => "SET NULL",
diff -r /home/yohann/koha/Koha/Schema/Result/AuthorisedValuesBranch.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/AuthorisedValuesBranch.pm
<     on_update     => "CASCADE",
>     on_update     => "RESTRICT",
<     on_update     => "CASCADE",
>     on_update     => "RESTRICT",
diff -r /home/yohann/koha/Koha/Schema/Result/Biblio.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Biblio.pm
< __PACKAGE__->belongs_to(
<     "biblioitem",
<     "Koha::Schema::Result::Biblioitem",
<     { "foreign.biblionumber" => "self.biblionumber" }
< );
diff -r /home/yohann/koha/Koha/Schema/Result/BorrowerAttributeTypesBranch.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/BorrowerAttributeTypesBranch.pm
<     on_update     => "CASCADE",
>     on_update     => "RESTRICT",
<     on_update     => "CASCADE",
>     on_update     => "RESTRICT",
diff -r /home/yohann/koha/Koha/Schema/Result/Borrower.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Borrower.pm
<   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
>   { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" },
<   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
>   { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" },
diff -r /home/yohann/koha/Koha/Schema/Result/CategoriesBranch.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/CategoriesBranch.pm
<     on_update     => "CASCADE",
>     on_update     => "RESTRICT",
<     on_update     => "CASCADE",
>     on_update     => "RESTRICT",
diff -r /home/yohann/koha/Koha/Schema/Result/ClassSource.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/ClassSource.pm
<   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
>   { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" },
diff -r /home/yohann/koha/Koha/Schema/Result/CourseInstructor.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/CourseInstructor.pm
<   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
>   { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" },
diff -r /home/yohann/koha/Koha/Schema/Result/CourseReserve.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/CourseReserve.pm
<   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
>   { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" },
diff -r /home/yohann/koha/Koha/Schema/Result/CreatorBatch.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/CreatorBatch.pm
<   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
>   { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" },
<     on_update     => "CASCADE",
>     on_update     => "RESTRICT",
diff -r /home/yohann/koha/Koha/Schema/Result/ImportRecord.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/ImportRecord.pm
< =head2 import_records_matches
> =head2 import_record_matches
< Related object: L<Koha::Schema::Result::ImportRecordMatches>
> Related object: L<Koha::Schema::Result::ImportRecordMatch>
<   "import_records_matches",
<   "Koha::Schema::Result::ImportRecordMatches",
>   "import_record_matches",
>   "Koha::Schema::Result::ImportRecordMatch",
diff -r /home/yohann/koha/Koha/Schema/Result/Issue.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Issue.pm
<     on_delete     => "CASCADE",
>     on_delete     => "RESTRICT",
<     on_delete     => "CASCADE",
>     on_delete     => "RESTRICT",
< __PACKAGE__->belongs_to(
<     "borrower",
<     "Koha::Schema::Result::Borrower",
<     { borrowernumber => "borrowernumber" },
<     { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
< );
< 
< __PACKAGE__->belongs_to(
<   "item",
<   "Koha::Schema::Result::Item",
<   { itemnumber => "itemnumber" },
<   {
<     is_deferrable => 1,
<     join_type     => "LEFT",
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
<   },
< );
< 
< __PACKAGE__->belongs_to(
<   "branch",
<   "Koha::Schema::Result::Branch",
<   { branchcode => "branchcode" },
<   {
<     is_deferrable => 1,
<     join_type     => "LEFT",
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
<   },
< );
diff -r /home/yohann/koha/Koha/Schema/Result/Item.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Item.pm
<     on_delete     => "CASCADE",
>     on_delete     => "RESTRICT",
<     on_delete     => "CASCADE",
>     on_delete     => "RESTRICT",
< __PACKAGE__->belongs_to(
<     "biblio",
<     "Koha::Schema::Result::Biblio",
<     { "foreign.biblionumber" => "self.biblionumber" }
< );
< 
< __PACKAGE__->belongs_to(
<   "biblioitem",
<   "Koha::Schema::Result::Biblioitem",
<   { biblioitemnumber => "biblioitemnumber" },
< );
< 
< sub effective_itemtype {
<     my ( $self ) = @_;
< 
<     my $pref = $self->result_source->schema->resultset('Systempreference')->find('item-level_itypes');
<     if ( $pref->value() ) {
<         return $self->itype();
<     } else {
<         return $self->biblioitem()->itemtype();
<     }
< }
diff -r /home/yohann/koha/Koha/Schema/Result/MessageQueue.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/MessageQueue.pm
<   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
>   { is_deferrable => 1, on_delete => "RESTRICT", on_update => "CASCADE" },
diff -r /home/yohann/koha/Koha/Schema/Result/OldIssue.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/OldIssue.pm
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
>     on_delete     => "SET NULL",
>     on_update     => "SET NULL",
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
>     on_delete     => "SET NULL",
>     on_update     => "SET NULL",
diff -r /home/yohann/koha/Koha/Schema/Result/OldReserve.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/OldReserve.pm
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
>     on_delete     => "SET NULL",
>     on_update     => "SET NULL",
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
>     on_delete     => "SET NULL",
>     on_update     => "SET NULL",
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
>     on_delete     => "SET NULL",
>     on_update     => "SET NULL",
diff -r /home/yohann/koha/Koha/Schema/Result/Reserve.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Reserve.pm
< __PACKAGE__->belongs_to(
<   "item",
<   "Koha::Schema::Result::Item",
<   { itemnumber => "itemnumber" },
<   {
<     is_deferrable => 1,
<     join_type     => "LEFT",
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
<   },
< );
< 
< __PACKAGE__->belongs_to(
<   "biblio",
<   "Koha::Schema::Result::Biblio",
<   { biblionumber => "biblionumber" },
<   {
<     is_deferrable => 1,
<     join_type     => "LEFT",
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
<   },
< );
diff -r /home/yohann/koha/Koha/Schema/Result/Review.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Review.pm
<     on_delete     => "CASCADE",
>     on_delete     => "SET NULL",
diff -r /home/yohann/koha/Koha/Schema/Result/Subscription.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Subscription.pm
<     on_delete     => "CASCADE",
>     on_delete     => "SET NULL",
<     on_delete     => "CASCADE",
>     on_delete     => "SET NULL",
diff -r /home/yohann/koha/Koha/Schema/Result/Virtualshelfcontent.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Virtualshelfcontent.pm
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
>     on_delete     => "SET NULL",
>     on_update     => "SET NULL",
diff -r /home/yohann/koha/Koha/Schema/Result/Virtualshelfshare.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Virtualshelfshare.pm
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
>     on_delete     => "SET NULL",
>     on_update     => "SET NULL",
diff -r /home/yohann/koha/Koha/Schema/Result/Virtualshelve.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Virtualshelve.pm
<     on_delete     => "CASCADE",
<     on_update     => "CASCADE",
>     on_delete     => "SET NULL",
>     on_update     => "SET NULL",
diff -r /home/yohann/koha/Koha/Schema/Result/Z3950server.pm /home/yohann/koha/misc/devel/Koha/Schema/Result/Z3950server.pm
<   extra: {list => ["primary","secondary"]}
>   extra: {list => ["primary","secondary",""]}
<     extra => { list => ["primary", "secondary"] },
>     extra => { list => ["primary", "secondary", ""] },


More information about the Koha-devel mailing list