Rename bump_count to bump_tally
This commit is contained in:
parent
fdf36b4738
commit
a0bf85d724
|
@ -36,8 +36,6 @@ Run the tests locally (against development environment):
|
||||||
[bcrypt](https://metacpan.org/pod/Mojolicious::Plugin::BcryptSecure)
|
[bcrypt](https://metacpan.org/pod/Mojolicious::Plugin::BcryptSecure)
|
||||||
1. Some sort of admin/moderator login and view
|
1. Some sort of admin/moderator login and view
|
||||||
1. CSS
|
1. CSS
|
||||||
1. Use [_tally](https://www.sqlstyle.guide/#uniform-suffixes) suffix
|
|
||||||
instead of _counter or _count
|
|
||||||
|
|
||||||
## Crazy future ideas
|
## Crazy future ideas
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ sub startup($self) {
|
||||||
# Finish configuring some things
|
# Finish configuring some things
|
||||||
$self->secrets($self->config->{'secrets'}) || die $@;
|
$self->secrets($self->config->{'secrets'}) || die $@;
|
||||||
|
|
||||||
$self->pg->migrations->from_dir('migrations')->migrate(7);
|
$self->pg->migrations->from_dir('migrations')->migrate(8);
|
||||||
|
|
||||||
if (my $threads_per_page = $self->config->{'threads_per_page'}) {
|
if (my $threads_per_page = $self->config->{'threads_per_page'}) {
|
||||||
$self->thread->per_page($threads_per_page)
|
$self->thread->per_page($threads_per_page)
|
||||||
|
|
|
@ -41,7 +41,7 @@ sub by_page($self, $this_page = 1) {
|
||||||
t.thread_title AS title,
|
t.thread_title AS title,
|
||||||
t.thread_body AS body,
|
t.thread_body AS body,
|
||||||
COUNT(r.*) AS remark_count,
|
COUNT(r.*) AS remark_count,
|
||||||
t.bump_count AS bump_count
|
t.bump_tally AS bump_tally
|
||||||
FROM threads AS t
|
FROM threads AS t
|
||||||
LEFT JOIN remarks AS r
|
LEFT JOIN remarks AS r
|
||||||
ON t.thread_id = r.thread_id
|
ON t.thread_id = r.thread_id
|
||||||
|
@ -92,7 +92,7 @@ sub bump($self, $thread_id) {
|
||||||
$self->pg->db->query(<<~'END_SQL', $thread_id)
|
$self->pg->db->query(<<~'END_SQL', $thread_id)
|
||||||
UPDATE threads
|
UPDATE threads
|
||||||
SET bump_date = NOW(),
|
SET bump_date = NOW(),
|
||||||
bump_count = bump_count + 1
|
bump_tally = bump_tally + 1
|
||||||
WHERE thread_id = ?;
|
WHERE thread_id = ?;
|
||||||
END_SQL
|
END_SQL
|
||||||
}
|
}
|
||||||
|
|
2
migrations/8/down.sql
Normal file
2
migrations/8/down.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE threads
|
||||||
|
RENAME COLUMN bump_tally TO bump_count;
|
2
migrations/8/up.sql
Normal file
2
migrations/8/up.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE threads
|
||||||
|
RENAME COLUMN bump_count TO bump_tally;
|
|
@ -21,7 +21,7 @@
|
||||||
</nav>
|
</nav>
|
||||||
<nav class="bumps">
|
<nav class="bumps">
|
||||||
<%= link_to bump_thread => {thread_id => $thread->{'id'}}, begin %>
|
<%= link_to bump_thread => {thread_id => $thread->{'id'}}, begin %>
|
||||||
Bump (<%= $thread->{'bump_count'} %> bumps)
|
Bump (<%= $thread->{'bump_tally'} %> bumps)
|
||||||
<% end %>
|
<% end %>
|
||||||
</nav>
|
</nav>
|
||||||
<nav>
|
<nav>
|
||||||
|
|
Loading…
Reference in a new issue