Skip to content

Commit

Permalink
perf(sql): Update attachments table
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulrahman1s committed Jul 13, 2022
1 parent 3c20f3d commit a6ea4cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions assets/migrations/00002_attachments.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE attachments
DROP COLUMN uploader_id,
ADD COLUMN content_type VARCHAR(64) NOT NULL;
4 changes: 2 additions & 2 deletions src/structures/base.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::pool;
use ormlite::model::*;
use sqlx::Postgres;
use sqlx::{Encode, Postgres, Type};

#[async_trait]
pub trait Base: Model<Postgres> {
Expand All @@ -22,7 +22,7 @@ pub trait Base: Model<Postgres> {

async fn find_one<'a, Arg>(id: Arg) -> Result<Self, ormlite::Error>
where
Arg: 'a + Send + sqlx::Encode<'a, sqlx::Postgres> + sqlx::Type<sqlx::Postgres>,
Arg: 'a + Send + Encode<'a, Postgres> + Type<Postgres>,
{
Self::get_one(id, pool()).await
}
Expand Down

0 comments on commit a6ea4cd

Please sign in to comment.