Rename bump_count to bump_tally

This commit is contained in:
swagg boi 2022-10-18 20:31:07 -04:00
parent fdf36b4738
commit a0bf85d724
6 changed files with 8 additions and 6 deletions

View file

@ -36,8 +36,6 @@ Run the tests locally (against development environment):
[bcrypt](https://metacpan.org/pod/Mojolicious::Plugin::BcryptSecure)
1. Some sort of admin/moderator login and view
1. CSS
1. Use [_tally](https://www.sqlstyle.guide/#uniform-suffixes) suffix
instead of _counter or _count
## Crazy future ideas

View file

@ -36,7 +36,7 @@ sub startup($self) {
# Finish configuring some things
$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'}) {
$self->thread->per_page($threads_per_page)

View file

@ -41,7 +41,7 @@ sub by_page($self, $this_page = 1) {
t.thread_title AS title,
t.thread_body AS body,
COUNT(r.*) AS remark_count,
t.bump_count AS bump_count
t.bump_tally AS bump_tally
FROM threads AS t
LEFT JOIN remarks AS r
ON t.thread_id = r.thread_id
@ -92,7 +92,7 @@ sub bump($self, $thread_id) {
$self->pg->db->query(<<~'END_SQL', $thread_id)
UPDATE threads
SET bump_date = NOW(),
bump_count = bump_count + 1
bump_tally = bump_tally + 1
WHERE thread_id = ?;
END_SQL
}

2
migrations/8/down.sql Normal file
View file

@ -0,0 +1,2 @@
ALTER TABLE threads
RENAME COLUMN bump_tally TO bump_count;

2
migrations/8/up.sql Normal file
View file

@ -0,0 +1,2 @@
ALTER TABLE threads
RENAME COLUMN bump_count TO bump_tally;

View file

@ -21,7 +21,7 @@
</nav>
<nav class="bumps">
<%= link_to bump_thread => {thread_id => $thread->{'id'}}, begin %>
Bump (<%= $thread->{'bump_count'} %> bumps)
Bump (<%= $thread->{'bump_tally'} %> bumps)
<% end %>
</nav>
<nav>