Create table for moderators
This commit is contained in:
parent
1ab0adfc8a
commit
fdf36b4738
|
@ -36,6 +36,8 @@ 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
|
||||
|
||||
|
|
1
cpanfile
1
cpanfile
|
@ -2,3 +2,4 @@ requires 'Mojolicious';
|
|||
requires 'Mojo::Pg';
|
||||
requires 'Mojolicious::Plugin::TagHelpers::Pagination';
|
||||
requires 'Mojolicious::Plugin::AssetPack';
|
||||
requires 'Mojolicious::Plugin::BcryptSecure';
|
||||
|
|
|
@ -11,6 +11,7 @@ sub startup($self) {
|
|||
$self->plugin('Config');
|
||||
$self->plugin('TagHelpers::Pagination');
|
||||
$self->plugin(AssetPack => {pipes => [qw{Css Combine}]});
|
||||
$self->plugin('BcryptSecure');
|
||||
|
||||
# Helpers
|
||||
$self->helper(pg => sub ($c) {
|
||||
|
@ -35,7 +36,7 @@ sub startup($self) {
|
|||
# Finish configuring some things
|
||||
$self->secrets($self->config->{'secrets'}) || die $@;
|
||||
|
||||
$self->pg->migrations->from_dir('migrations')->migrate(6);
|
||||
$self->pg->migrations->from_dir('migrations')->migrate(7);
|
||||
|
||||
if (my $threads_per_page = $self->config->{'threads_per_page'}) {
|
||||
$self->thread->per_page($threads_per_page)
|
||||
|
|
|
@ -42,8 +42,8 @@ sub by_page($self, $this_page = 1) {
|
|||
t.thread_body AS body,
|
||||
COUNT(r.*) AS remark_count,
|
||||
t.bump_count AS bump_count
|
||||
FROM threads t
|
||||
LEFT JOIN remarks r
|
||||
FROM threads AS t
|
||||
LEFT JOIN remarks AS r
|
||||
ON t.thread_id = r.thread_id
|
||||
WHERE NOT t.hidden_status
|
||||
GROUP BY t.thread_id
|
||||
|
|
1
migrations/7/down.sql
Normal file
1
migrations/7/down.sql
Normal file
|
@ -0,0 +1 @@
|
|||
DROP TABLE moderators;
|
9
migrations/7/up.sql
Normal file
9
migrations/7/up.sql
Normal file
|
@ -0,0 +1,9 @@
|
|||
CREATE TABLE IF NOT EXISTS moderators (
|
||||
moderator_id SERIAL PRIMARY KEY,
|
||||
moderator_name VARCHAR(64) NOT NULL,
|
||||
email_addr VARCHAR(320) NOT NULL,
|
||||
password_hash VARCHAR(64) NOT NULL,
|
||||
creation_date TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
last_login_date TIMESTAMPTZ NOT NULL DEFAULT '2000-01-01',
|
||||
lock_status BOOLEAN NOT NULL DEFAULT FALSE
|
||||
);
|
Loading…
Reference in a new issue