Browse Source

Add filetype to gists

master
Dylan Baker 5 years ago
parent
commit
1b3aa6ac9b

+ 1
- 0
migrations/2019-05-01-185345_add_filetype_to_gists/down.sql View File

@@ -0,0 +1 @@
1
+ALTER TABLE gists DROP COLUMN filetype;

+ 1
- 0
migrations/2019-05-01-185345_add_filetype_to_gists/up.sql View File

@@ -0,0 +1 @@
1
+ALTER TABLE gists ADD COLUMN filetype VARCHAR(255) DEFAULT NULL;

+ 2
- 0
src/gists/mod.rs View File

@@ -10,6 +10,7 @@ pub struct Gist {
10 10
     pub title: String,
11 11
     pub body: String,
12 12
     pub created_at: Option<NaiveDateTime>,
13
+    pub filetype: Option<String>,
13 14
 }
14 15
 
15 16
 #[derive(Insertable, AsChangeset, Serialize, Deserialize)]
@@ -17,6 +18,7 @@ pub struct Gist {
17 18
 pub struct InsertableGist {
18 19
     pub title: String,
19 20
     pub body: String,
21
+    pub filetype: Option<String>,
20 22
 }
21 23
 
22 24
 pub fn all(connection: &PGC) -> QueryResult<Vec<Gist>> {

+ 1
- 0
src/schema.rs View File

@@ -4,5 +4,6 @@ table! {
4 4
         title -> Varchar,
5 5
         body -> Text,
6 6
         created_at -> Nullable<Timestamp>,
7
+        filetype -> Nullable<Varchar>,
7 8
     }
8 9
 }

Loading…
Cancel
Save