create table media
This commit is contained in:
parent
412a54d647
commit
ed211f2d72
2
migrations/2025-04-10-120721_media_table/down.sql
Normal file
2
migrations/2025-04-10-120721_media_table/down.sql
Normal file
@ -0,0 +1,2 @@
|
||||
DROP TABLE media;
|
||||
|
||||
6
migrations/2025-04-10-120721_media_table/up.sql
Normal file
6
migrations/2025-04-10-120721_media_table/up.sql
Normal file
@ -0,0 +1,6 @@
|
||||
CREATE TABLE media (
|
||||
id SERIAL PRIMARY KEY,
|
||||
token VARCHAR NOT NULL,
|
||||
media_type VARCHAR NOT NULL,
|
||||
file_id VARCHAR NOT NULL
|
||||
);
|
||||
@ -24,6 +24,15 @@ pub struct Literal {
|
||||
pub value: String,
|
||||
}
|
||||
|
||||
#[derive(Queryable, Debug, Identifiable)]
|
||||
#[diesel(table_name = media)]
|
||||
pub struct Media {
|
||||
pub id: i32,
|
||||
pub token: String,
|
||||
pub media_type: String,
|
||||
pub file_id: String,
|
||||
}
|
||||
|
||||
#[derive(Queryable, Debug, Identifiable)]
|
||||
#[diesel(table_name = messages)]
|
||||
pub struct Message {
|
||||
|
||||
@ -16,6 +16,15 @@ diesel::table! {
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
media (id) {
|
||||
id -> Int4,
|
||||
token -> Varchar,
|
||||
media_type -> Varchar,
|
||||
file_id -> Varchar,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
messages (id) {
|
||||
id -> Int4,
|
||||
@ -66,6 +75,7 @@ diesel::joinable!(reservations -> users (user_id));
|
||||
diesel::allow_tables_to_appear_in_same_query!(
|
||||
events,
|
||||
literals,
|
||||
media,
|
||||
messages,
|
||||
reservations,
|
||||
teloxide_dialogues,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user