ok all is good on the western front

This commit is contained in:
dal 2025-03-07 09:19:47 -07:00
parent 582fb9869c
commit 47e1558e2e
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
3 changed files with 36 additions and 12 deletions

View File

@ -521,6 +521,18 @@ diesel::table! {
}
}
diesel::table! {
threads (id) {
id -> Uuid,
title -> Text,
organization_id -> Uuid,
created_at -> Timestamptz,
updated_at -> Timestamptz,
deleted_at -> Nullable<Timestamptz>,
created_by -> Uuid,
}
}
diesel::table! {
threads_deprecated (id) {
id -> Uuid,
@ -637,6 +649,8 @@ diesel::joinable!(teams_to_users -> users (user_id));
diesel::joinable!(terms -> organizations (organization_id));
diesel::joinable!(terms_to_datasets -> datasets (dataset_id));
diesel::joinable!(terms_to_datasets -> terms (term_id));
diesel::joinable!(threads -> organizations (organization_id));
diesel::joinable!(threads -> users (created_by));
diesel::joinable!(threads_deprecated -> organizations (organization_id));
diesel::joinable!(threads_to_dashboards -> dashboards (dashboard_id));
diesel::joinable!(threads_to_dashboards -> threads_deprecated (thread_id));
@ -675,6 +689,7 @@ diesel::allow_tables_to_appear_in_same_query!(
teams_to_users,
terms,
terms_to_datasets,
threads,
threads_deprecated,
threads_to_dashboards,
user_favorites,

View File

@ -1,11 +1,11 @@
-- This file should undo anything in `up.sql`
-- Drop indexes
DROP INDEX chats_organization_id_idx;
DROP INDEX chats_created_by_idx;
DROP INDEX chats_created_at_idx;
-- Drop new threads table
DROP TABLE chats;
-- Drop indexes if they exist
DROP INDEX IF EXISTS chats_organization_id_idx;
DROP INDEX IF EXISTS chats_created_by_idx;
DROP INDEX IF EXISTS chats_created_at_idx;
-- Drop new threads table if it exists
DROP TABLE IF EXISTS chats;
-- Rename deprecated table back to threads
ALTER TABLE threads_deprecated RENAME TO threads;

View File

@ -1,11 +1,20 @@
-- This file should undo anything in `up.sql`
-- Drop indexes
DROP INDEX messages_chat_id_idx;
DROP INDEX messages_created_by_idx;
DROP INDEX messages_created_at_idx;
-- Drop indexes first
DROP INDEX IF EXISTS messages_chat_id_idx;
DROP INDEX IF EXISTS messages_created_by_idx;
DROP INDEX IF EXISTS messages_created_at_idx;
-- Drop new messages table
DROP TABLE messages;
-- Rename deprecated table back to messages
ALTER TABLE messages_deprecated RENAME TO messages;
-- Drop existing constraint if it exists
ALTER TABLE messages
DROP CONSTRAINT IF EXISTS messages_thread_id_fkey;
-- Restore foreign key constraint
ALTER TABLE messages
ADD CONSTRAINT messages_thread_id_fkey
FOREIGN KEY (thread_id) REFERENCES threads(id);