Rename table
This commit is contained in:
parent
9f6144704b
commit
d7613d8b04
|
@ -77,7 +77,7 @@ app->secrets(app->config->{'secrets'}) || die $@;
|
||||||
app->message->max_posts(app->config->{'max_posts'})
|
app->message->max_posts(app->config->{'max_posts'})
|
||||||
if app->config->{'max_posts'};
|
if app->config->{'max_posts'};
|
||||||
|
|
||||||
app->pg->migrations->from_dir('migrations')->migrate(3);
|
app->pg->migrations->from_dir('migrations')->migrate(4);
|
||||||
|
|
||||||
app->asset->store->paths(['assets']);
|
app->asset->store->paths(['assets']);
|
||||||
app->asset->process('swagg.css', 'css/swagg.css');
|
app->asset->process('swagg.css', 'css/swagg.css');
|
||||||
|
|
|
@ -22,7 +22,7 @@ sub get_posts($self, $this_page = undef) {
|
||||||
SELECT to_char(message_date, 'Dy Mon DD HH:MI:SS AM TZ YYYY'),
|
SELECT to_char(message_date, 'Dy Mon DD HH:MI:SS AM TZ YYYY'),
|
||||||
visitor_name,
|
visitor_name,
|
||||||
message
|
message
|
||||||
FROM messages
|
FROM guestbook
|
||||||
ORDER BY message_date DESC
|
ORDER BY message_date DESC
|
||||||
LIMIT ? OFFSET ?;
|
LIMIT ? OFFSET ?;
|
||||||
END_SQL
|
END_SQL
|
||||||
|
@ -32,7 +32,7 @@ sub get_posts($self, $this_page = undef) {
|
||||||
SELECT to_char(message_date, 'Dy Mon DD HH:MI:SS AM TZ YYYY'),
|
SELECT to_char(message_date, 'Dy Mon DD HH:MI:SS AM TZ YYYY'),
|
||||||
visitor_name,
|
visitor_name,
|
||||||
message
|
message
|
||||||
FROM messages
|
FROM guestbook
|
||||||
ORDER BY message_date DESC;
|
ORDER BY message_date DESC;
|
||||||
END_SQL
|
END_SQL
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ sub get_posts($self, $this_page = undef) {
|
||||||
|
|
||||||
sub create_post($self, $name, $message) {
|
sub create_post($self, $name, $message) {
|
||||||
$self->pg->db->query(<<~'END_SQL', $name, $message)
|
$self->pg->db->query(<<~'END_SQL', $name, $message)
|
||||||
INSERT INTO messages (message_date, visitor_name, message)
|
INSERT INTO guestbook (message_date, visitor_name, message)
|
||||||
VALUES (NOW(), ?, ?);
|
VALUES (NOW(), ?, ?);
|
||||||
END_SQL
|
END_SQL
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ sub get_last_page($self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_post_count($self) {
|
sub get_post_count($self) {
|
||||||
$self->pg->db->query('SELECT count(*) FROM messages;')->text()
|
$self->pg->db->query('SELECT count(*) FROM guestbook;')->text()
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
1
migrations/4/down.sql
Normal file
1
migrations/4/down.sql
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE guestbook RENAME TO messages;
|
1
migrations/4/up.sql
Normal file
1
migrations/4/up.sql
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE messages RENAME TO guestbook;
|
Loading…
Reference in a new issue