diff --git a/README.md b/README.md index 5ad508d..1fa049b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/PostText.pm b/lib/PostText.pm index de80fe4..30361d6 100644 --- a/lib/PostText.pm +++ b/lib/PostText.pm @@ -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) diff --git a/lib/PostText/Model/Thread.pm b/lib/PostText/Model/Thread.pm index 1bc8c47..54a7520 100644 --- a/lib/PostText/Model/Thread.pm +++ b/lib/PostText/Model/Thread.pm @@ -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 } diff --git a/migrations/8/down.sql b/migrations/8/down.sql new file mode 100644 index 0000000..df3e86b --- /dev/null +++ b/migrations/8/down.sql @@ -0,0 +1,2 @@ + ALTER TABLE threads +RENAME COLUMN bump_tally TO bump_count; diff --git a/migrations/8/up.sql b/migrations/8/up.sql new file mode 100644 index 0000000..45e6257 --- /dev/null +++ b/migrations/8/up.sql @@ -0,0 +1,2 @@ + ALTER TABLE threads +RENAME COLUMN bump_count TO bump_tally; diff --git a/templates/thread/by_page.html.ep b/templates/thread/by_page.html.ep index 744eea4..b557456 100644 --- a/templates/thread/by_page.html.ep +++ b/templates/thread/by_page.html.ep @@ -21,7 +21,7 @@