Bug 21946: DBIC schema changes
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 13 Aug 2020 08:14:49 +0000 (10:14 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 13 Aug 2020 08:15:33 +0000 (10:15 +0200)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Koha/Schema/Result/Itemtype.pm

index b180a90..3a4c46a 100644 (file)
@@ -30,6 +30,13 @@ __PACKAGE__->table("itemtypes");
   is_nullable: 0
   size: 10
 
+=head2 parent_type
+
+  data_type: 'varchar'
+  is_foreign_key: 1
+  is_nullable: 1
+  size: 10
+
 =head2 description
 
   data_type: 'longtext'
@@ -129,6 +136,8 @@ __PACKAGE__->table("itemtypes");
 __PACKAGE__->add_columns(
   "itemtype",
   { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
+  "parent_type",
+  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
   "description",
   { data_type => "longtext", is_nullable => 1 },
   "rentalcharge",
@@ -197,6 +206,21 @@ __PACKAGE__->has_many(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
+=head2 itemtypes
+
+Type: has_many
+
+Related object: L<Koha::Schema::Result::Itemtype>
+
+=cut
+
+__PACKAGE__->has_many(
+  "itemtypes",
+  "Koha::Schema::Result::Itemtype",
+  { "foreign.parent_type" => "self.itemtype" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
 =head2 itemtypes_branches
 
 Type: has_many
@@ -227,6 +251,26 @@ __PACKAGE__->has_many(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
+=head2 parent_type
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Itemtype>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "parent_type",
+  "Koha::Schema::Result::Itemtype",
+  { itemtype => "parent_type" },
+  {
+    is_deferrable => 1,
+    join_type     => "LEFT",
+    on_delete     => "CASCADE",
+    on_update     => "CASCADE",
+  },
+);
+
 =head2 reserves
 
 Type: has_many
@@ -243,8 +287,8 @@ __PACKAGE__->has_many(
 );
 
 
-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-09 17:13:18
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7ojvTzsDvdHPAJMwJrAZ7A
+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-08-13 08:14:04
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5RxmTmtrwJJhTZMur1N05A
 
 __PACKAGE__->add_columns(
     '+rentalcharge_hourly_calendar' => { is_boolean => 1 },