From ee1d099c6acdb38a173a7455804724f3a1b78836 Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Thu, 5 Apr 2018 22:52:02 -0400 Subject: consolidate memes to one table --- src/db/schema.rs | 46 +++++++++++----------------------------------- 1 file changed, 11 insertions(+), 35 deletions(-) (limited to 'src/db/schema.rs') diff --git a/src/db/schema.rs b/src/db/schema.rs index 40891a5..cf15dcd 100644 --- a/src/db/schema.rs +++ b/src/db/schema.rs @@ -6,15 +6,6 @@ table! { } } -table! { - audio_memes (id) { - id -> Int4, - title -> Varchar, - audio_id -> Int4, - metadata_id -> Int4, - } -} - table! { audit_records (id) { id -> Int4, @@ -25,18 +16,20 @@ table! { } table! { - image_memes (id) { + images (id) { id -> Int4, - title -> Varchar, - image_id -> Int4, + data -> Bytea, metadata_id -> Int4, } } table! { - images (id) { + memes (id) { id -> Int4, - data -> Bytea, + title -> Varchar, + content -> Nullable, + image_id -> Nullable, + audio_id -> Nullable, metadata_id -> Int4, } } @@ -49,34 +42,17 @@ table! { } } -table! { - text_memes (id) { - id -> Int4, - title -> Varchar, - content -> Text, - image_id -> Nullable, - audio_id -> Nullable, - metadata_id -> Int4, - } -} - joinable!(audio -> metadata (metadata_id)); -joinable!(audio_memes -> audio (audio_id)); -joinable!(audio_memes -> metadata (metadata_id)); joinable!(audit_records -> metadata (metadata_id)); -joinable!(image_memes -> images (image_id)); -joinable!(image_memes -> metadata (metadata_id)); joinable!(images -> metadata (metadata_id)); -joinable!(text_memes -> audio (audio_id)); -joinable!(text_memes -> images (image_id)); -joinable!(text_memes -> metadata (metadata_id)); +joinable!(memes -> audio (audio_id)); +joinable!(memes -> images (image_id)); +joinable!(memes -> metadata (metadata_id)); allow_tables_to_appear_in_same_query!( audio, - audio_memes, audit_records, - image_memes, images, + memes, metadata, - text_memes, ); -- cgit v1.3.1