-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b55da7e
commit ee88e4b
Showing
6 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ALTER TABLE attachments | ||
ADD COLUMN deleted BOOLEAN NOT NULL DEFAULT FALSE; | ||
|
||
ALTER TABLE messages | ||
ADD COLUMN attachments JSONB NOT NULL DEFAULT '[]'::JSONB; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use super::Base; | ||
use ormlite::model::*; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[serde_as] | ||
#[derive(Model, FromRow, Serialize, Deserialize, Debug, OpgModel, Clone)] | ||
#[ormlite(table = "attachments")] | ||
pub struct Attachment { | ||
#[serde_as(as = "serde_with::DisplayFromStr")] | ||
#[opg(string)] | ||
pub id: i64, | ||
pub filename: String, | ||
#[serde(skip_serializing_if = "Option::is_none", default)] | ||
pub width: Option<i32>, | ||
#[serde(skip_serializing_if = "Option::is_none", default)] | ||
pub height: Option<i32>, | ||
pub content_type: String, | ||
pub size: i32, | ||
#[serde(skip_serializing, default)] | ||
pub deleted: bool, | ||
} | ||
|
||
impl Base for Attachment {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters