Skip to content

Commit 68ce9c6

Browse files
committed
Pending Blog Blog Entries
1 parent 50b1bab commit 68ce9c6

File tree

3 files changed

+169
-2
lines changed

3 files changed

+169
-2
lines changed

DB/etc/schema.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ CREATE TABLE blog_entry (
9393
description text ,
9494
created_at timestamptz not null default current_timestamp
9595
);
96+
-- RSS Reader will create these for the blogs.
97+
CREATE TABLE pending_blog_entry (
98+
id serial PRIMARY KEY,
99+
blog_id int not null references pending_blog(id),
100+
title text not null,
101+
url text not null,
102+
publish_date timestamptz not null,
103+
description text ,
104+
created_at timestamptz not null default current_timestamp
105+
);
96106

97107
-- Tags that are approved.
98108
CREATE TABLE tag (

DB/lib/BlogDB/DB/Result/PendingBlog.pm

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,21 @@ __PACKAGE__->add_unique_constraint("pending_blog_url_key", ["url"]);
183183

184184
=head1 RELATIONS
185185
186+
=head2 pending_blog_entries
187+
188+
Type: has_many
189+
190+
Related object: L<BlogDB::DB::Result::PendingBlogEntry>
191+
192+
=cut
193+
194+
__PACKAGE__->has_many(
195+
"pending_blog_entries",
196+
"BlogDB::DB::Result::PendingBlogEntry",
197+
{ "foreign.blog_id" => "self.id" },
198+
{ cascade_copy => 0, cascade_delete => 0 },
199+
);
200+
186201
=head2 pending_blog_tag_maps
187202
188203
Type: has_many
@@ -219,8 +234,8 @@ __PACKAGE__->belongs_to(
219234
);
220235

221236

222-
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-11-21 05:50:00
223-
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8bolOwz93fFR3o6V2hJ5rA
237+
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-11-24 04:45:56
238+
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:F4GsyDnhsW34Ywl+BCrVEw
224239

225240

226241
# You can replace this text with custom code or comments, and it will be preserved on regeneration
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
use utf8;
2+
package BlogDB::DB::Result::PendingBlogEntry;
3+
4+
# Created by DBIx::Class::Schema::Loader
5+
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6+
7+
=head1 NAME
8+
9+
BlogDB::DB::Result::PendingBlogEntry
10+
11+
=cut
12+
13+
use strict;
14+
use warnings;
15+
16+
use base 'DBIx::Class::Core';
17+
18+
=head1 COMPONENTS LOADED
19+
20+
=over 4
21+
22+
=item * L<DBIx::Class::InflateColumn::DateTime>
23+
24+
=item * L<DBIx::Class::InflateColumn::Serializer>
25+
26+
=back
27+
28+
=cut
29+
30+
__PACKAGE__->load_components("InflateColumn::DateTime", "InflateColumn::Serializer");
31+
32+
=head1 TABLE: C<pending_blog_entry>
33+
34+
=cut
35+
36+
__PACKAGE__->table("pending_blog_entry");
37+
38+
=head1 ACCESSORS
39+
40+
=head2 id
41+
42+
data_type: 'integer'
43+
is_auto_increment: 1
44+
is_nullable: 0
45+
sequence: 'pending_blog_entry_id_seq'
46+
47+
=head2 blog_id
48+
49+
data_type: 'integer'
50+
is_foreign_key: 1
51+
is_nullable: 0
52+
53+
=head2 title
54+
55+
data_type: 'text'
56+
is_nullable: 0
57+
58+
=head2 url
59+
60+
data_type: 'text'
61+
is_nullable: 0
62+
63+
=head2 publish_date
64+
65+
data_type: 'timestamp with time zone'
66+
is_nullable: 0
67+
68+
=head2 description
69+
70+
data_type: 'text'
71+
is_nullable: 1
72+
73+
=head2 created_at
74+
75+
data_type: 'timestamp with time zone'
76+
default_value: current_timestamp
77+
is_nullable: 0
78+
79+
=cut
80+
81+
__PACKAGE__->add_columns(
82+
"id",
83+
{
84+
data_type => "integer",
85+
is_auto_increment => 1,
86+
is_nullable => 0,
87+
sequence => "pending_blog_entry_id_seq",
88+
},
89+
"blog_id",
90+
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
91+
"title",
92+
{ data_type => "text", is_nullable => 0 },
93+
"url",
94+
{ data_type => "text", is_nullable => 0 },
95+
"publish_date",
96+
{ data_type => "timestamp with time zone", is_nullable => 0 },
97+
"description",
98+
{ data_type => "text", is_nullable => 1 },
99+
"created_at",
100+
{
101+
data_type => "timestamp with time zone",
102+
default_value => \"current_timestamp",
103+
is_nullable => 0,
104+
},
105+
);
106+
107+
=head1 PRIMARY KEY
108+
109+
=over 4
110+
111+
=item * L</id>
112+
113+
=back
114+
115+
=cut
116+
117+
__PACKAGE__->set_primary_key("id");
118+
119+
=head1 RELATIONS
120+
121+
=head2 blog
122+
123+
Type: belongs_to
124+
125+
Related object: L<BlogDB::DB::Result::PendingBlog>
126+
127+
=cut
128+
129+
__PACKAGE__->belongs_to(
130+
"blog",
131+
"BlogDB::DB::Result::PendingBlog",
132+
{ id => "blog_id" },
133+
{ is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
134+
);
135+
136+
137+
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-11-24 04:45:56
138+
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:n4ZdA/apfHAt4UlFa9ybSA
139+
140+
141+
# You can replace this text with custom code or comments, and it will be preserved on regeneration
142+
1;

0 commit comments

Comments
 (0)