Drop is_markdown column

This commit is contained in:
Konrad Borowski 2019-11-22 19:04:13 +01:00
parent 4f66513447
commit c864bcdd92
5 changed files with 7 additions and 5 deletions

View File

@ -0,0 +1,2 @@
ALTER TABLE languages ADD COLUMN is_markdown boolean NOT NULL DEFAULT FALSE;
UPDATE languages SET is_markdown = TRUE WHERE identifier = 'markdown';

View File

@ -0,0 +1 @@
ALTER TABLE languages DROP COLUMN is_markdown;

View File

@ -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()

View File

@ -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)

View File

@ -25,7 +25,6 @@ table! {
language_id -> Int4,
priority -> Int4,
name -> Text,
is_markdown -> Bool,
identifier -> Text,
}
}