delete files left after diesel orm

This commit is contained in:
Akulij 2025-05-03 16:50:35 +03:00
parent caca9e354d
commit 09950579da
41 changed files with 0 additions and 324 deletions

View File

@ -1,9 +0,0 @@
# For documentation on how to configure this file,
# see https://diesel.rs/guides/configuring-diesel-cli
[print_schema]
file = "src/db/schema.rs"
custom_type_derives = ["diesel_derive_enum::DbEnum", "diesel::query_builder::QueryId", "Clone"]
[migrations_directory]
dir = "./migrations"

View File

View File

@ -1,6 +0,0 @@
-- This file was automatically created by Diesel to setup helper functions
-- and other internal bookkeeping. This file is safe to edit, any future
-- changes will be added to existing projects as new migrations.
DROP FUNCTION IF EXISTS diesel_manage_updated_at(_tbl regclass);
DROP FUNCTION IF EXISTS diesel_set_updated_at();

View File

@ -1,36 +0,0 @@
-- This file was automatically created by Diesel to setup helper functions
-- and other internal bookkeeping. This file is safe to edit, any future
-- changes will be added to existing projects as new migrations.
-- Sets up a trigger for the given table to automatically set a column called
-- `updated_at` whenever the row is modified (unless `updated_at` was included
-- in the modified columns)
--
-- # Example
--
-- ```sql
-- CREATE TABLE users (id SERIAL PRIMARY KEY, updated_at TIMESTAMP NOT NULL DEFAULT NOW());
--
-- SELECT diesel_manage_updated_at('users');
-- ```
CREATE OR REPLACE FUNCTION diesel_manage_updated_at(_tbl regclass) RETURNS VOID AS $$
BEGIN
EXECUTE format('CREATE TRIGGER set_updated_at BEFORE UPDATE ON %s
FOR EACH ROW EXECUTE PROCEDURE diesel_set_updated_at()', _tbl);
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION diesel_set_updated_at() RETURNS trigger AS $$
BEGIN
IF (
NEW IS DISTINCT FROM OLD AND
NEW.updated_at IS NOT DISTINCT FROM OLD.updated_at
) THEN
NEW.updated_at := current_timestamp;
END IF;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;

View File

@ -1 +0,0 @@
DROP TABLE users

View File

@ -1,5 +0,0 @@
CREATE TABLE users (
id SERIAL PRIMARY KEY,
is_admin BOOLEAN NOT NULL DEFAULT FALSE
)

View File

@ -1,2 +0,0 @@
ALTER TABLE users
DROP COLUMN user_id;

View File

@ -1,2 +0,0 @@
ALTER TABLE users
ADD COLUMN user_id BIGINT NOT NULL;

View File

@ -1,4 +0,0 @@
ALTER TABLE users
ALTER COLUMN id TYPE integer;
ALTER TABLE users
ADD COLUMN user_id BIGINT NOT NULL;

View File

@ -1,4 +0,0 @@
ALTER TABLE users
ALTER COLUMN id TYPE BIGINT;
ALTER TABLE users
DROP COLUMN user_id;

View File

@ -1,6 +0,0 @@
<<<<<<< HEAD
=======
ALTER TABLE users
ALTER COLUMN id TYPE BIGINT;
>>>>>>> Snippet

View File

@ -1 +0,0 @@
DROP TABLE IF EXISTS messages;

View File

@ -1,7 +0,0 @@
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)
);

View File

@ -1 +0,0 @@
DROP TABLE IF EXISTS literals;

View File

@ -1,5 +0,0 @@
CREATE TABLE literals (
id SERIAL PRIMARY KEY,
token VARCHAR(255) UNIQUE NOT NULL,
value TEXT
);

View File

@ -1,2 +0,0 @@
ALTER TABLE literals
ALTER COLUMN value DROP NOT NULL;

View File

@ -1,2 +0,0 @@
ALTER TABLE literals
ALTER COLUMN value SET NOT NULL;

View File

@ -1,5 +0,0 @@
ALTER TABLE users
DROP COLUMN first_name,
DROP COLUMN last_name,
DROP COLUMN username,
DROP COLUMN language_code;

View File

@ -1,5 +0,0 @@
ALTER TABLE users
ADD COLUMN first_name VARCHAR(255),
ADD COLUMN last_name VARCHAR(255),
ADD COLUMN username VARCHAR(255),
ADD COLUMN language_code VARCHAR(10);

View File

@ -1,6 +0,0 @@
-- This file should undo anything in `up.sql`
ALTER TABLE "users" ALTER COLUMN "first_name" DROP NOT NULL;

View File

@ -1,6 +0,0 @@
-- Your SQL goes here
ALTER TABLE "users" ALTER COLUMN "first_name" SET NOT NULL;

View File

@ -1,2 +0,0 @@
DROP TABLE events;

View File

@ -1,4 +0,0 @@
CREATE TABLE events (
id SERIAL PRIMARY KEY,
time TIMESTAMP UNIQUE NOT NULL
);

View File

@ -1,2 +0,0 @@
DROP TABLE reservations;
DROP TYPE reservation_status;

View File

@ -1,10 +0,0 @@
CREATE TYPE reservation_status AS ENUM ('booked', 'paid');
CREATE TABLE reservations (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id),
entered_name VARCHAR(255),
booked_time TIMESTAMP NOT NULL,
event_id INTEGER REFERENCES events(id),
status reservation_status NOT NULL
);

View File

@ -1,2 +0,0 @@
CREATE TYPE reservation_status AS ENUM ('booked', 'paid');
ALTER TABLE reservations ALTER COLUMN status TYPE reservation_status USING status::reservation_status;

View File

@ -1,2 +0,0 @@
ALTER TABLE reservations ALTER COLUMN status TYPE VARCHAR;
DROP TYPE reservation_status;

View File

@ -1,2 +0,0 @@
ALTER TABLE reservations
ALTER COLUMN user_id TYPE INTEGER;

View File

@ -1,2 +0,0 @@
ALTER TABLE reservations
ALTER COLUMN user_id TYPE BIGINT;

View File

@ -1,4 +0,0 @@
ALTER TABLE reservations
ALTER COLUMN user_id DROP NOT NULL,
ALTER COLUMN entered_name DROP NOT NULL,
ALTER COLUMN event_id DROP NOT NULL;

View File

@ -1,4 +0,0 @@
ALTER TABLE reservations
ALTER COLUMN user_id SET NOT NULL,
ALTER COLUMN entered_name SET NOT NULL,
ALTER COLUMN event_id SET NOT NULL;

View File

@ -1,2 +0,0 @@
ALTER TABLE events
ALTER COLUMN time TYPE TIMESTAMP;

View File

@ -1,2 +0,0 @@
ALTER TABLE events
ALTER COLUMN time TYPE TIMESTAMPTZ;

View File

@ -1,2 +0,0 @@
DROP TABLE media;

View File

@ -1,6 +0,0 @@
CREATE TABLE media (
id SERIAL PRIMARY KEY,
token VARCHAR NOT NULL,
media_type VARCHAR NOT NULL,
file_id VARCHAR NOT NULL
);

View File

@ -1 +0,0 @@
ALTER TABLE media DROP COLUMN media_group_id;

View File

@ -1,2 +0,0 @@
ALTER TABLE media ADD COLUMN media_group_id VARCHAR NOT NULL;

View File

@ -1 +0,0 @@
ALTER TABLE media ALTER COLUMN media_group_id SET NOT NULL;

View File

@ -1 +0,0 @@
ALTER TABLE media ALTER COLUMN media_group_id DROP NOT NULL;

View File

@ -1,74 +0,0 @@
// Generated by diesel_ext
#![allow(unused)]
#![allow(clippy::all)]
use crate::db::schema::*;
use chrono::offset::Utc;
use chrono::DateTime;
use chrono::NaiveDateTime;
use diesel::prelude::*;
#[derive(Queryable, Debug, Identifiable)]
#[diesel(table_name = events)]
pub struct Event {
pub id: i32,
pub time: DateTime<Utc>,
}
#[derive(Queryable, Debug, Identifiable)]
#[diesel(table_name = literals)]
pub struct Literal {
pub id: i32,
pub token: String,
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,
pub media_group_id: Option<String>,
}
#[derive(Queryable, Debug, Identifiable)]
#[diesel(table_name = messages)]
pub struct Message {
pub id: i32,
pub chat_id: i64,
pub message_id: i64,
pub token: String,
}
#[derive(Queryable, Debug, Identifiable)]
#[diesel(table_name = reservations)]
pub struct Reservation {
pub id: i32,
pub user_id: i64,
pub entered_name: String,
pub booked_time: NaiveDateTime,
pub event_id: i32,
pub status: String,
}
#[derive(Queryable, Debug, Identifiable)]
#[diesel(primary_key(chat_id))]
#[diesel(table_name = teloxide_dialogues)]
pub struct TeloxideDialogue {
pub chat_id: i64,
pub dialogue: Vec<u8>,
}
#[derive(Queryable, Debug)]
#[diesel(table_name = users)]
pub struct User {
pub id: i64,
pub is_admin: bool,
pub first_name: String,
pub last_name: Option<String>,
pub username: Option<String>,
pub language_code: Option<String>,
}

View File

@ -1,84 +0,0 @@
// @generated automatically by Diesel CLI.
diesel::table! {
events (id) {
id -> Int4,
time -> Timestamptz,
}
}
diesel::table! {
literals (id) {
id -> Int4,
#[max_length = 255]
token -> Varchar,
value -> Text,
}
}
diesel::table! {
media (id) {
id -> Int4,
token -> Varchar,
media_type -> Varchar,
file_id -> Varchar,
media_group_id -> Nullable<Varchar>,
}
}
diesel::table! {
messages (id) {
id -> Int4,
chat_id -> Int8,
message_id -> Int8,
#[max_length = 255]
token -> Varchar,
}
}
diesel::table! {
reservations (id) {
id -> Int4,
user_id -> Int8,
#[max_length = 255]
entered_name -> Varchar,
booked_time -> Timestamp,
event_id -> Int4,
status -> Varchar,
}
}
diesel::table! {
teloxide_dialogues (chat_id) {
chat_id -> Int8,
dialogue -> Bytea,
}
}
diesel::table! {
users (id) {
id -> Int8,
is_admin -> Bool,
#[max_length = 255]
first_name -> Varchar,
#[max_length = 255]
last_name -> Nullable<Varchar>,
#[max_length = 255]
username -> Nullable<Varchar>,
#[max_length = 10]
language_code -> Nullable<Varchar>,
}
}
diesel::joinable!(reservations -> events (event_id));
diesel::joinable!(reservations -> users (user_id));
diesel::allow_tables_to_appear_in_same_query!(
events,
literals,
media,
messages,
reservations,
teloxide_dialogues,
users,
);