From 44cf4f4499e2ae8eda734ad6322f9141a978cb62 Mon Sep 17 00:00:00 2001 From: Kaitlyn Parkhurst Date: Thu, 15 Sep 2022 14:46:07 -0700 Subject: [PATCH] New DB stuff. --- DB/lib/MJB/DB/Result/BasicAuth.pm | 143 +++++++++++++++++++++++ DB/lib/MJB/DB/Result/Blog.pm | 19 +++- DB/lib/MJB/DB/Result/Person.pm | 34 +++++- DB/lib/MJB/DB/Result/Repo.pm | 182 ++++++++++++++++++++++++++++++ DB/lib/MJB/DB/Result/SshKey.pm | 150 ++++++++++++++++++++++++ 5 files changed, 524 insertions(+), 4 deletions(-) create mode 100644 DB/lib/MJB/DB/Result/BasicAuth.pm create mode 100644 DB/lib/MJB/DB/Result/Repo.pm create mode 100644 DB/lib/MJB/DB/Result/SshKey.pm diff --git a/DB/lib/MJB/DB/Result/BasicAuth.pm b/DB/lib/MJB/DB/Result/BasicAuth.pm new file mode 100644 index 0000000..e8b3867 --- /dev/null +++ b/DB/lib/MJB/DB/Result/BasicAuth.pm @@ -0,0 +1,143 @@ +use utf8; +package MJB::DB::Result::BasicAuth; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +MJB::DB::Result::BasicAuth + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 COMPONENTS LOADED + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->load_components("InflateColumn::DateTime", "InflateColumn::Serializer"); + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("basic_auth"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'basic_auth_id_seq' + +=head2 person_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 username + + data_type: 'text' + is_nullable: 0 + +=head2 password + + data_type: 'text' + is_nullable: 0 + +=head2 created_at + + data_type: 'timestamp with time zone' + default_value: current_timestamp + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "basic_auth_id_seq", + }, + "person_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "username", + { data_type => "text", is_nullable => 0 }, + "password", + { data_type => "text", is_nullable => 0 }, + "created_at", + { + data_type => "timestamp with time zone", + default_value => \"current_timestamp", + is_nullable => 0, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 person + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "person", + "MJB::DB::Result::Person", + { id => "person_id" }, + { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, +); + +=head2 repoes + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "repoes", + "MJB::DB::Result::Repo", + { "foreign.basic_auth_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-15 21:45:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1LtVymHyzVae3ckPba5ROA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/DB/lib/MJB/DB/Result/Blog.pm b/DB/lib/MJB/DB/Result/Blog.pm index 4261088..a782d20 100644 --- a/DB/lib/MJB/DB/Result/Blog.pm +++ b/DB/lib/MJB/DB/Result/Blog.pm @@ -212,9 +212,24 @@ __PACKAGE__->belongs_to( { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, ); +=head2 repoes -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-07 05:14:59 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nXEEcu7TDNPHpSGNnle5Dw +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "repoes", + "MJB::DB::Result::Repo", + { "foreign.blog_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-15 21:45:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:L3dxpgcZP09t4/pKOLFDUA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/DB/lib/MJB/DB/Result/Person.pm b/DB/lib/MJB/DB/Result/Person.pm index dfee84c..1d94087 100644 --- a/DB/lib/MJB/DB/Result/Person.pm +++ b/DB/lib/MJB/DB/Result/Person.pm @@ -156,6 +156,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 basic_auths + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "basic_auths", + "MJB::DB::Result::BasicAuth", + { "foreign.person_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 blogs Type: has_many @@ -201,9 +216,24 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 ssh_keys + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "ssh_keys", + "MJB::DB::Result::SshKey", + { "foreign.person_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-07 05:14:59 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:StVpNq9qBRBsCb1DYsPjoA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-15 21:45:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:H5AJ0pMQgh7bHRBH3sC4hA use Data::GUID; diff --git a/DB/lib/MJB/DB/Result/Repo.pm b/DB/lib/MJB/DB/Result/Repo.pm new file mode 100644 index 0000000..de95238 --- /dev/null +++ b/DB/lib/MJB/DB/Result/Repo.pm @@ -0,0 +1,182 @@ +use utf8; +package MJB::DB::Result::Repo; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +MJB::DB::Result::Repo + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 COMPONENTS LOADED + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->load_components("InflateColumn::DateTime", "InflateColumn::Serializer"); + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("repo"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'repo_id_seq' + +=head2 blog_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +=head2 url + + data_type: 'text' + is_nullable: 0 + +=head2 basic_auth_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +=head2 ssh_key_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +=head2 created_at + + data_type: 'timestamp with time zone' + default_value: current_timestamp + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "repo_id_seq", + }, + "blog_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "url", + { data_type => "text", is_nullable => 0 }, + "basic_auth_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "ssh_key_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "created_at", + { + data_type => "timestamp with time zone", + default_value => \"current_timestamp", + is_nullable => 0, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 basic_auth + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "basic_auth", + "MJB::DB::Result::BasicAuth", + { id => "basic_auth_id" }, + { + is_deferrable => 0, + join_type => "LEFT", + on_delete => "NO ACTION", + on_update => "NO ACTION", + }, +); + +=head2 blog + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "blog", + "MJB::DB::Result::Blog", + { id => "blog_id" }, + { + is_deferrable => 0, + join_type => "LEFT", + on_delete => "NO ACTION", + on_update => "NO ACTION", + }, +); + +=head2 ssh_key + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "ssh_key", + "MJB::DB::Result::SshKey", + { id => "ssh_key_id" }, + { + is_deferrable => 0, + join_type => "LEFT", + on_delete => "NO ACTION", + on_update => "NO ACTION", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-15 21:45:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1W7mgkNfoG1qrxdg7YXdrw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/DB/lib/MJB/DB/Result/SshKey.pm b/DB/lib/MJB/DB/Result/SshKey.pm new file mode 100644 index 0000000..49e547f --- /dev/null +++ b/DB/lib/MJB/DB/Result/SshKey.pm @@ -0,0 +1,150 @@ +use utf8; +package MJB::DB::Result::SshKey; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +MJB::DB::Result::SshKey + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 COMPONENTS LOADED + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->load_components("InflateColumn::DateTime", "InflateColumn::Serializer"); + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("ssh_key"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'ssh_key_id_seq' + +=head2 person_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 title + + data_type: 'text' + is_nullable: 1 + +=head2 public_key + + data_type: 'text' + is_nullable: 0 + +=head2 private_key + + data_type: 'text' + is_nullable: 0 + +=head2 created_at + + data_type: 'timestamp with time zone' + default_value: current_timestamp + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "ssh_key_id_seq", + }, + "person_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "title", + { data_type => "text", is_nullable => 1 }, + "public_key", + { data_type => "text", is_nullable => 0 }, + "private_key", + { data_type => "text", is_nullable => 0 }, + "created_at", + { + data_type => "timestamp with time zone", + default_value => \"current_timestamp", + is_nullable => 0, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 person + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "person", + "MJB::DB::Result::Person", + { id => "person_id" }, + { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, +); + +=head2 repoes + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "repoes", + "MJB::DB::Result::Repo", + { "foreign.ssh_key_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-15 21:45:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qYPaCRZsz0cOc6HtKnK4Rw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1;