From cc4aee4ab49f060d9f427a7615dc9163a8f5c1b3 Mon Sep 17 00:00:00 2001 From: Ethan Girouard Date: Thu, 16 May 2024 18:13:14 -0400 Subject: [PATCH] Add image_path column to albums table --- migrations/2024-05-16-220659_add_album_images/down.sql | 1 + migrations/2024-05-16-220659_add_album_images/up.sql | 1 + src/models.rs | 2 ++ src/schema.rs | 1 + 4 files changed, 5 insertions(+) create mode 100644 migrations/2024-05-16-220659_add_album_images/down.sql create mode 100644 migrations/2024-05-16-220659_add_album_images/up.sql diff --git a/migrations/2024-05-16-220659_add_album_images/down.sql b/migrations/2024-05-16-220659_add_album_images/down.sql new file mode 100644 index 0000000..118e9b5 --- /dev/null +++ b/migrations/2024-05-16-220659_add_album_images/down.sql @@ -0,0 +1 @@ +ALTER TABLE albums DROP COLUMN image_path; diff --git a/migrations/2024-05-16-220659_add_album_images/up.sql b/migrations/2024-05-16-220659_add_album_images/up.sql new file mode 100644 index 0000000..b9f26dc --- /dev/null +++ b/migrations/2024-05-16-220659_add_album_images/up.sql @@ -0,0 +1 @@ +ALTER TABLE albums ADD COLUMN image_path VARCHAR; diff --git a/src/models.rs b/src/models.rs index 15a6d12..8aaec04 100644 --- a/src/models.rs +++ b/src/models.rs @@ -177,6 +177,8 @@ pub struct Album { pub title: String, /// The album's release date pub release_date: Option, + /// The path to the album's image file + pub image_path: Option, } impl Album { diff --git a/src/schema.rs b/src/schema.rs index b98d736..97de324 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -12,6 +12,7 @@ diesel::table! { id -> Int4, title -> Varchar, release_date -> Nullable, + image_path -> Nullable, } }