create messages table
This commit is contained in:
parent
7777aadf6a
commit
c93d2f1ee8
@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS messages;
|
||||
7
migrations/2025-04-03-130758_message_literal_map/up.sql
Normal file
7
migrations/2025-04-03-130758_message_literal_map/up.sql
Normal file
@ -0,0 +1,7 @@
|
||||
CREATE TABLE messages (
|
||||
id SERIAL PRIMARY KEY,
|
||||
chat_id BIGINT NOT NULL,
|
||||
message_id BIGINT NOT NULL,
|
||||
token VARCHAR(255) NOT NULL,
|
||||
UNIQUE (chat_id, message_id)
|
||||
);
|
||||
@ -3,10 +3,21 @@
|
||||
#![allow(unused)]
|
||||
#![allow(clippy::all)]
|
||||
|
||||
|
||||
use diesel::prelude::*;
|
||||
#[derive(Queryable, Debug)]
|
||||
#[diesel(table_name = messages)]
|
||||
pub struct Message {
|
||||
pub id: i32,
|
||||
pub chat_id: i64,
|
||||
pub message_id: i64,
|
||||
pub token: String,
|
||||
}
|
||||
|
||||
#[derive(Queryable, Debug)]
|
||||
#[diesel(table_name = users)]
|
||||
pub struct User {
|
||||
pub id: i64,
|
||||
pub is_admin: bool,
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,23 @@
|
||||
// @generated automatically by Diesel CLI.
|
||||
|
||||
diesel::table! {
|
||||
messages (id) {
|
||||
id -> Int4,
|
||||
chat_id -> Int8,
|
||||
message_id -> Int8,
|
||||
#[max_length = 255]
|
||||
token -> Varchar,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
users (id) {
|
||||
id -> Int8,
|
||||
is_admin -> Bool,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::allow_tables_to_appear_in_same_query!(
|
||||
messages,
|
||||
users,
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user