diff --git a/DB/etc/schema.sql b/DB/etc/schema.sql index 5519d1c..feb2c34 100644 --- a/DB/etc/schema.sql +++ b/DB/etc/schema.sql @@ -96,6 +96,8 @@ CREATE TABLE repo ( created_at timestamptz not null default current_timestamp ); +-- +-- TODO: Remove this after everything is updated for the jobs table CREATE TABLE build ( id serial PRIMARY KEY, blog_id int not null references blog(id), @@ -103,6 +105,21 @@ CREATE TABLE build ( created_at timestamptz not null default current_timestamp ); +-- For jobs that should show up on the web interface in Blog Manager -> Jobs. +CREATE TABLE job ( + id serial PRIMARY KEY, + blog_id int not null references blog(id), + minion_job_id int not null, -- For minion->job($id) + created_at timestamptz not null default current_timestamp +); + +-- For jobs that should show up on the web interface in Admin Panel -> Jobs. +CREATE TABLE admin_job ( + id serial PRIMARY KEY, + minion_job_id int not null, -- For minion->job($id) + created_at timestamptz not null default current_timestamp +); + -- The domains that a user can host their blog under. CREATE TABLE hosted_domain ( id serial PRIMARY KEY, diff --git a/DB/lib/MJB/DB/Result/AdminJob.pm b/DB/lib/MJB/DB/Result/AdminJob.pm new file mode 100644 index 0000000..daaafb9 --- /dev/null +++ b/DB/lib/MJB/DB/Result/AdminJob.pm @@ -0,0 +1,96 @@ +use utf8; +package MJB::DB::Result::AdminJob; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +MJB::DB::Result::AdminJob + +=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("admin_job"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'admin_job_id_seq' + +=head2 minion_job_id + + data_type: 'integer' + 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 => "admin_job_id_seq", + }, + "minion_job_id", + { data_type => "integer", 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"); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-09 14:53:07 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cBdbwYX0+0iPbxVol0Iskg + + +# 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 f7dadac..200fa6d 100644 --- a/DB/lib/MJB/DB/Result/Blog.pm +++ b/DB/lib/MJB/DB/Result/Blog.pm @@ -197,6 +197,21 @@ __PACKAGE__->belongs_to( }, ); +=head2 jobs + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "jobs", + "MJB::DB::Result::Job", + { "foreign.blog_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 person Type: belongs_to @@ -228,8 +243,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-15 21:45:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:L3dxpgcZP09t4/pKOLFDUA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-09 14:53:07 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pO7hPHfNDn6x5GP7apAUTg use DateTime; diff --git a/DB/lib/MJB/DB/Result/Job.pm b/DB/lib/MJB/DB/Result/Job.pm new file mode 100644 index 0000000..85049ec --- /dev/null +++ b/DB/lib/MJB/DB/Result/Job.pm @@ -0,0 +1,121 @@ +use utf8; +package MJB::DB::Result::Job; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +MJB::DB::Result::Job + +=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("job"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'job_id_seq' + +=head2 blog_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 minion_job_id + + data_type: 'integer' + 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 => "job_id_seq", + }, + "blog_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "minion_job_id", + { data_type => "integer", 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 blog + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "blog", + "MJB::DB::Result::Blog", + { id => "blog_id" }, + { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-09 14:53:07 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pe81AkUx/77N6bBy1hrx0g + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1;