From 11e25ddf3b959bb3cb9a54380f08f18d076e2b41 Mon Sep 17 00:00:00 2001
From: Aleisha Amohia <aleishaamohia@hotmail.com>
Date: Tue, 23 Apr 2019 22:19:42 +0000
Subject: [PATCH] Bug 8628: Digital signs - schema updates

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
---
 Koha/Schema/Result/SavedSql.pm      |  21 +++++-
 Koha/Schema/Result/Sign.pm          | 132 ++++++++++++++++++++++++++++++++++++
 Koha/Schema/Result/SignStream.pm    | 105 ++++++++++++++++++++++++++++
 Koha/Schema/Result/SignsToStream.pm | 114 +++++++++++++++++++++++++++++++
 4 files changed, 370 insertions(+), 2 deletions(-)
 create mode 100644 Koha/Schema/Result/Sign.pm
 create mode 100644 Koha/Schema/Result/SignStream.pm
 create mode 100644 Koha/Schema/Result/SignsToStream.pm

diff --git a/Koha/Schema/Result/SavedSql.pm b/Koha/Schema/Result/SavedSql.pm
index f8567b3723..5604846080 100644
--- a/Koha/Schema/Result/SavedSql.pm
+++ b/Koha/Schema/Result/SavedSql.pm
@@ -169,9 +169,26 @@ __PACKAGE__->add_columns(
 
 __PACKAGE__->set_primary_key("id");
 
+=head1 RELATIONS
 
-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-01-23 12:56:39
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:f7wxGGnBk3z6mw2CkaeD9A
+=head2 sign_streams
+
+Type: has_many
+
+Related object: L<Koha::Schema::Result::SignStream>
+
+=cut
+
+__PACKAGE__->has_many(
+  "sign_streams",
+  "Koha::Schema::Result::SignStream",
+  { "foreign.saved_sql_id" => "self.id" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2019-04-23 22:14:56
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:49NVnmBe/cLc8xLJ2UFmpw
 
 sub koha_object_class {
     'Koha::Report';
diff --git a/Koha/Schema/Result/Sign.pm b/Koha/Schema/Result/Sign.pm
new file mode 100644
index 0000000000..1911844e92
--- /dev/null
+++ b/Koha/Schema/Result/Sign.pm
@@ -0,0 +1,132 @@
+use utf8;
+package Koha::Schema::Result::Sign;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+Koha::Schema::Result::Sign
+
+=cut
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+=head1 TABLE: C<signs>
+
+=cut
+
+__PACKAGE__->table("signs");
+
+=head1 ACCESSORS
+
+=head2 sign_id
+
+  data_type: 'integer'
+  is_auto_increment: 1
+  is_nullable: 0
+
+=head2 name
+
+  data_type: 'varchar'
+  is_nullable: 1
+  size: 64
+
+=head2 webapp
+
+  data_type: 'integer'
+  default_value: 0
+  is_nullable: 0
+
+=head2 transition
+
+  data_type: 'char'
+  default_value: 'none'
+  is_nullable: 0
+  size: 16
+
+=head2 swatch
+
+  data_type: 'char'
+  default_value: (empty string)
+  is_nullable: 0
+  size: 1
+
+=head2 idleafter
+
+  data_type: 'integer'
+  default_value: 0
+  is_nullable: 0
+
+=head2 pagedelay
+
+  data_type: 'integer'
+  default_value: 0
+  is_nullable: 0
+
+=head2 reloadafter
+
+  data_type: 'integer'
+  default_value: 0
+  is_nullable: 0
+
+=cut
+
+__PACKAGE__->add_columns(
+  "sign_id",
+  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
+  "name",
+  { data_type => "varchar", is_nullable => 1, size => 64 },
+  "webapp",
+  { data_type => "integer", default_value => 0, is_nullable => 0 },
+  "transition",
+  { data_type => "char", default_value => "none", is_nullable => 0, size => 16 },
+  "swatch",
+  { data_type => "char", default_value => "", is_nullable => 0, size => 1 },
+  "idleafter",
+  { data_type => "integer", default_value => 0, is_nullable => 0 },
+  "pagedelay",
+  { data_type => "integer", default_value => 0, is_nullable => 0 },
+  "reloadafter",
+  { data_type => "integer", default_value => 0, is_nullable => 0 },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</sign_id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("sign_id");
+
+=head1 RELATIONS
+
+=head2 signs_to_streams
+
+Type: has_many
+
+Related object: L<Koha::Schema::Result::SignsToStream>
+
+=cut
+
+__PACKAGE__->has_many(
+  "signs_to_streams",
+  "Koha::Schema::Result::SignsToStream",
+  { "foreign.sign_id" => "self.sign_id" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2019-04-23 22:14:56
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sPXDFstwvROyMN0guYnQiA
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+1;
diff --git a/Koha/Schema/Result/SignStream.pm b/Koha/Schema/Result/SignStream.pm
new file mode 100644
index 0000000000..a0fe0dc5c5
--- /dev/null
+++ b/Koha/Schema/Result/SignStream.pm
@@ -0,0 +1,105 @@
+use utf8;
+package Koha::Schema::Result::SignStream;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+Koha::Schema::Result::SignStream
+
+=cut
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+=head1 TABLE: C<sign_streams>
+
+=cut
+
+__PACKAGE__->table("sign_streams");
+
+=head1 ACCESSORS
+
+=head2 sign_stream_id
+
+  data_type: 'integer'
+  is_auto_increment: 1
+  is_nullable: 0
+
+=head2 saved_sql_id
+
+  data_type: 'integer'
+  is_foreign_key: 1
+  is_nullable: 0
+
+=head2 name
+
+  data_type: 'varchar'
+  is_nullable: 1
+  size: 64
+
+=cut
+
+__PACKAGE__->add_columns(
+  "sign_stream_id",
+  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
+  "saved_sql_id",
+  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
+  "name",
+  { data_type => "varchar", is_nullable => 1, size => 64 },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</sign_stream_id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("sign_stream_id");
+
+=head1 RELATIONS
+
+=head2 saved_sql
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::SavedSql>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "saved_sql",
+  "Koha::Schema::Result::SavedSql",
+  { id => "saved_sql_id" },
+  { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" },
+);
+
+=head2 signs_to_streams
+
+Type: has_many
+
+Related object: L<Koha::Schema::Result::SignsToStream>
+
+=cut
+
+__PACKAGE__->has_many(
+  "signs_to_streams",
+  "Koha::Schema::Result::SignsToStream",
+  { "foreign.sign_stream_id" => "self.sign_stream_id" },
+  { cascade_copy => 0, cascade_delete => 0 },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2019-04-23 22:14:56
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:k94lZfT0zHEvDtc4GPWQKQ
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+1;
diff --git a/Koha/Schema/Result/SignsToStream.pm b/Koha/Schema/Result/SignsToStream.pm
new file mode 100644
index 0000000000..88fa2c22d6
--- /dev/null
+++ b/Koha/Schema/Result/SignsToStream.pm
@@ -0,0 +1,114 @@
+use utf8;
+package Koha::Schema::Result::SignsToStream;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+=head1 NAME
+
+Koha::Schema::Result::SignsToStream
+
+=cut
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+=head1 TABLE: C<signs_to_streams>
+
+=cut
+
+__PACKAGE__->table("signs_to_streams");
+
+=head1 ACCESSORS
+
+=head2 sign_to_stream_id
+
+  data_type: 'integer'
+  is_auto_increment: 1
+  is_nullable: 0
+
+=head2 sign_stream_id
+
+  data_type: 'integer'
+  is_foreign_key: 1
+  is_nullable: 0
+
+=head2 sign_id
+
+  data_type: 'integer'
+  is_foreign_key: 1
+  is_nullable: 0
+
+=head2 params
+
+  data_type: 'varchar'
+  default_value: (empty string)
+  is_nullable: 0
+  size: 255
+
+=cut
+
+__PACKAGE__->add_columns(
+  "sign_to_stream_id",
+  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
+  "sign_stream_id",
+  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
+  "sign_id",
+  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
+  "params",
+  { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 },
+);
+
+=head1 PRIMARY KEY
+
+=over 4
+
+=item * L</sign_to_stream_id>
+
+=back
+
+=cut
+
+__PACKAGE__->set_primary_key("sign_to_stream_id");
+
+=head1 RELATIONS
+
+=head2 sign
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Sign>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "sign",
+  "Koha::Schema::Result::Sign",
+  { sign_id => "sign_id" },
+  { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" },
+);
+
+=head2 sign_stream
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::SignStream>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "sign_stream",
+  "Koha::Schema::Result::SignStream",
+  { sign_stream_id => "sign_stream_id" },
+  { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2019-04-23 22:14:56
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:I8v4LIKe5HxaemotFqXI6A
+
+
+# You can replace this text with custom code or comments, and it will be preserved on regeneration
+1;
-- 
2.11.0