Commit cbc70576 authored by Konrad Borowski's avatar Konrad Borowski

Merge branch 'drop-is-markdown-column' into 'master'

Drop is_markdown column

See merge request pastebin.run/server!76
parents 4f665134 c864bcdd
Pipeline #97941603 passed with stages
in 14 minutes and 58 seconds
ALTER TABLE languages ADD COLUMN is_markdown boolean NOT NULL DEFAULT FALSE;
UPDATE languages SET is_markdown = TRUE WHERE identifier = 'markdown';
ALTER TABLE languages DROP COLUMN is_markdown;
......@@ -17,7 +17,7 @@ pub struct Paste {
pub paste: String,
pub language_id: i32,
pub delete_at: Option<DateTime<Utc>>,
pub is_markdown: bool,
pub identifier: String,
}
impl Paste {
......@@ -86,10 +86,10 @@ impl ExternPaste {
let Paste {
paste,
language_id,
identifier,
delete_at,
is_markdown,
} = paste;
let markdown = if is_markdown {
let markdown = if identifier == "markdown" {
render_markdown(&paste)
} else {
String::new()
......
......@@ -23,7 +23,7 @@ pub fn display_paste(
pastes::paste,
pastes::language_id,
pastes::delete_at,
languages::is_markdown,
languages::identifier,
))
.filter(pastes::identifier.eq(requested_identifier))
.get_result(connection)
......
......@@ -25,7 +25,6 @@ table! {
language_id -> Int4,
priority -> Int4,
name -> Text,
is_markdown -> Bool,
identifier -> Text,
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment