浏览代码

Add filetype to gists

master
Dylan Baker 6 年前
父节点
当前提交
1b3aa6ac9b

+ 1
- 0
migrations/2019-05-01-185345_add_filetype_to_gists/down.sql 查看文件

1
+ALTER TABLE gists DROP COLUMN filetype;

+ 1
- 0
migrations/2019-05-01-185345_add_filetype_to_gists/up.sql 查看文件

1
+ALTER TABLE gists ADD COLUMN filetype VARCHAR(255) DEFAULT NULL;

+ 2
- 0
src/gists/mod.rs 查看文件

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

+ 1
- 0
src/schema.rs 查看文件

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

正在加载...
取消
保存