Plume/plume-models/src/schema.rs

338 lines
7.1 KiB
Rust
Raw Permalink Normal View History

table! {
api_tokens (id) {
id -> Int4,
creation_date -> Timestamp,
value -> Text,
scopes -> Text,
app_id -> Int4,
user_id -> Int4,
}
}
table! {
apps (id) {
id -> Int4,
name -> Text,
client_id -> Text,
client_secret -> Text,
redirect_uri -> Nullable<Text>,
website -> Nullable<Text>,
creation_date -> Timestamp,
}
}
2018-04-23 11:27:27 +00:00
table! {
blog_authors (id) {
id -> Int4,
blog_id -> Int4,
author_id -> Int4,
is_owner -> Bool,
}
}
2018-04-23 10:29:27 +00:00
table! {
blogs (id) {
id -> Int4,
actor_id -> Varchar,
title -> Varchar,
summary -> Text,
outbox_url -> Varchar,
inbox_url -> Varchar,
instance_id -> Int4,
2018-04-30 17:46:27 +00:00
creation_date -> Timestamp,
2018-05-01 18:02:29 +00:00
ap_url -> Text,
private_key -> Nullable<Text>,
public_key -> Text,
fqn -> Text,
summary_html -> Text,
icon_id -> Nullable<Int4>,
banner_id -> Nullable<Int4>,
theme -> Nullable<Varchar>,
2018-04-23 10:29:27 +00:00
}
}
2018-05-09 20:35:02 +00:00
table! {
comments (id) {
id -> Int4,
content -> Text,
in_response_to_id -> Nullable<Int4>,
post_id -> Int4,
author_id -> Int4,
creation_date -> Timestamp,
ap_url -> Nullable<Varchar>,
sensitive -> Bool,
spoiler_text -> Text,
public_visibility -> Bool,
}
}
table! {
comment_seers (id) {
id -> Int4,
comment_id -> Int4,
user_id -> Int4,
2018-05-09 20:35:02 +00:00
}
}
2022-01-04 13:03:47 +00:00
table! {
2022-01-29 16:16:51 +00:00
email_blocklist (id) {
id -> Int4,
2022-01-29 16:16:51 +00:00
email_address -> Text,
note -> Text,
notify_user -> Bool,
notification_text -> Text,
}
}
2018-05-09 20:35:02 +00:00
2022-01-04 13:03:47 +00:00
table! {
email_signups (id) {
id -> Int4,
email -> Varchar,
token -> Varchar,
expiration_date -> Timestamp,
}
}
2018-05-01 13:06:31 +00:00
table! {
follows (id) {
id -> Int4,
follower_id -> Int4,
following_id -> Int4,
ap_url -> Text,
2018-05-01 13:06:31 +00:00
}
}
table! {
instances (id) {
id -> Int4,
public_domain -> Varchar,
name -> Varchar,
local -> Bool,
blocked -> Bool,
2018-04-30 17:46:27 +00:00
creation_date -> Timestamp,
open_registrations -> Bool,
short_description -> Text,
long_description -> Text,
default_license -> Text,
long_description_html -> Varchar,
short_description_html -> Varchar,
}
}
2018-04-22 18:13:12 +00:00
2018-05-10 15:54:35 +00:00
table! {
likes (id) {
id -> Int4,
user_id -> Int4,
post_id -> Int4,
creation_date -> Timestamp,
2018-05-13 10:44:05 +00:00
ap_url -> Varchar,
2018-05-10 15:54:35 +00:00
}
}
Add support for generic timeline (#525) * Begin adding support for timeline * fix some bugs with parser * fmt * add error reporting for parser * add tests for timeline query parser * add rejection tests for parse * begin adding support for lists also run migration before compiling, so schema.rs is up to date * add sqlite migration * end adding lists still miss tests and query integration * cargo fmt * try to add some tests * Add some constraint to db, and fix list test and refactor other tests to use begin_transaction * add more tests for lists * add support for lists in query executor * add keywords for including/excluding boosts and likes * cargo fmt * add function to list lists used by query will make it easier to warn users when creating timeline with unknown lists * add lang support * add timeline creation error message when using unexisting lists * Update .po files * WIP: interface for timelines * don't use diesel for migrations not sure how it passed the ci on the other branch * add some tests for timeline add an int representing the order of timelines (first one will be on top, second just under...) use first() instead of limit(1).get().into_iter().nth(0) remove migrations from build artifacts as they are now compiled in * cargo fmt * remove timeline order * fix tests * add tests for timeline creation failure * cargo fmt * add tests for timelines * add test for matching direct lists and keywords * add test for language filtering * Add a more complex test for Timeline::matches, and fix TQ::matches for TQ::Or * Make the main crate compile + FMT * Use the new timeline system - Replace the old "feed" system with timelines - Display all timelines someone can access on their home page (either their personal ones, or instance timelines) - Remove functions that were used to get user/local/federated feed - Add new posts to timelines - Create a default timeline called "My feed" for everyone, and "Local feed"/"Federated feed" with timelines @fdb-hiroshima I don't know if that's how you pictured it? If you imagined it differently I can of course make changes. I hope I didn't forgot anything… * Cargo fmt * Try to fix the migration * Fix tests * Fix the test (for real this time ?) * Fix the tests ? + fmt * Use Kind::Like and Kind::Reshare when needed * Forgot to run cargo fmt once again * revert translations * fix reviewed stuff * reduce code duplication by macros * cargo fmt
2019-10-07 17:08:20 +00:00
table! {
list_elems (id) {
id -> Int4,
list_id -> Int4,
user_id -> Nullable<Int4>,
blog_id -> Nullable<Int4>,
word -> Nullable<Varchar>,
}
}
table! {
lists (id) {
id -> Int4,
name -> Varchar,
user_id -> Nullable<Int4>,
#[sql_name = "type"]
type_ -> Int4,
}
}
2018-09-02 11:34:48 +00:00
table! {
medias (id) {
id -> Int4,
file_path -> Text,
alt_text -> Text,
is_remote -> Bool,
remote_url -> Nullable<Text>,
sensitive -> Bool,
content_warning -> Nullable<Text>,
2018-09-02 20:55:42 +00:00
owner_id -> Int4,
2018-09-02 11:34:48 +00:00
}
}
2018-06-20 18:22:34 +00:00
table! {
mentions (id) {
id -> Int4,
mentioned_id -> Int4,
post_id -> Nullable<Int4>,
comment_id -> Nullable<Int4>,
}
}
2018-05-13 12:44:18 +00:00
table! {
notifications (id) {
id -> Int4,
user_id -> Int4,
2018-05-24 10:12:27 +00:00
creation_date -> Timestamp,
2018-07-26 13:46:10 +00:00
kind -> Varchar,
object_id -> Int4,
2018-05-13 12:44:18 +00:00
}
}
table! {
password_reset_requests (id) {
id -> Int4,
email -> Varchar,
token -> Varchar,
expiration_date -> Timestamp,
}
}
2018-04-23 14:37:49 +00:00
table! {
post_authors (id) {
id -> Int4,
post_id -> Int4,
author_id -> Int4,
}
}
2018-04-23 13:41:43 +00:00
table! {
posts (id) {
id -> Int4,
blog_id -> Int4,
slug -> Varchar,
title -> Varchar,
content -> Text,
published -> Bool,
license -> Varchar,
2018-04-30 17:46:27 +00:00
creation_date -> Timestamp,
2018-05-10 10:52:56 +00:00
ap_url -> Varchar,
2018-09-04 11:26:13 +00:00
subtitle -> Text,
source -> Text,
cover_id -> Nullable<Int4>,
2018-04-23 13:41:43 +00:00
}
}
2018-05-19 09:23:02 +00:00
table! {
reshares (id) {
id -> Int4,
user_id -> Int4,
post_id -> Int4,
ap_url -> Varchar,
creation_date -> Timestamp,
}
}
2018-09-05 18:05:53 +00:00
table! {
tags (id) {
id -> Int4,
tag -> Text,
is_hashtag -> Bool,
2018-09-05 18:05:53 +00:00
post_id -> Int4,
}
}
Add support for generic timeline (#525) * Begin adding support for timeline * fix some bugs with parser * fmt * add error reporting for parser * add tests for timeline query parser * add rejection tests for parse * begin adding support for lists also run migration before compiling, so schema.rs is up to date * add sqlite migration * end adding lists still miss tests and query integration * cargo fmt * try to add some tests * Add some constraint to db, and fix list test and refactor other tests to use begin_transaction * add more tests for lists * add support for lists in query executor * add keywords for including/excluding boosts and likes * cargo fmt * add function to list lists used by query will make it easier to warn users when creating timeline with unknown lists * add lang support * add timeline creation error message when using unexisting lists * Update .po files * WIP: interface for timelines * don't use diesel for migrations not sure how it passed the ci on the other branch * add some tests for timeline add an int representing the order of timelines (first one will be on top, second just under...) use first() instead of limit(1).get().into_iter().nth(0) remove migrations from build artifacts as they are now compiled in * cargo fmt * remove timeline order * fix tests * add tests for timeline creation failure * cargo fmt * add tests for timelines * add test for matching direct lists and keywords * add test for language filtering * Add a more complex test for Timeline::matches, and fix TQ::matches for TQ::Or * Make the main crate compile + FMT * Use the new timeline system - Replace the old "feed" system with timelines - Display all timelines someone can access on their home page (either their personal ones, or instance timelines) - Remove functions that were used to get user/local/federated feed - Add new posts to timelines - Create a default timeline called "My feed" for everyone, and "Local feed"/"Federated feed" with timelines @fdb-hiroshima I don't know if that's how you pictured it? If you imagined it differently I can of course make changes. I hope I didn't forgot anything… * Cargo fmt * Try to fix the migration * Fix tests * Fix the test (for real this time ?) * Fix the tests ? + fmt * Use Kind::Like and Kind::Reshare when needed * Forgot to run cargo fmt once again * revert translations * fix reviewed stuff * reduce code duplication by macros * cargo fmt
2019-10-07 17:08:20 +00:00
table! {
timeline (id) {
id -> Int4,
post_id -> Int4,
timeline_id -> Int4,
}
}
table! {
timeline_definition (id) {
id -> Int4,
user_id -> Nullable<Int4>,
name -> Varchar,
query -> Varchar,
}
}
2018-04-22 18:13:12 +00:00
table! {
users (id) {
id -> Int4,
username -> Varchar,
display_name -> Varchar,
outbox_url -> Varchar,
inbox_url -> Varchar,
summary -> Text,
email -> Nullable<Text>,
hashed_password -> Nullable<Text>,
instance_id -> Int4,
2018-04-30 17:46:27 +00:00
creation_date -> Timestamp,
2018-05-01 18:02:29 +00:00
ap_url -> Text,
private_key -> Nullable<Text>,
public_key -> Text,
shared_inbox_url -> Nullable<Varchar>,
2018-07-27 10:53:21 +00:00
followers_endpoint -> Varchar,
avatar_id -> Nullable<Int4>,
last_fetched_date -> Timestamp,
fqn -> Text,
summary_html -> Text,
role -> Int4,
preferred_theme -> Nullable<Varchar>,
hide_custom_css -> Bool,
2018-04-22 18:13:12 +00:00
}
}
joinable!(api_tokens -> apps (app_id));
joinable!(api_tokens -> users (user_id));
2018-04-23 11:27:27 +00:00
joinable!(blog_authors -> blogs (blog_id));
joinable!(blog_authors -> users (author_id));
2018-04-23 10:29:27 +00:00
joinable!(blogs -> instances (instance_id));
joinable!(comment_seers -> comments (comment_id));
joinable!(comment_seers -> users (user_id));
2018-05-09 20:35:02 +00:00
joinable!(comments -> posts (post_id));
joinable!(comments -> users (author_id));
2018-05-10 15:54:35 +00:00
joinable!(likes -> posts (post_id));
joinable!(likes -> users (user_id));
Add support for generic timeline (#525) * Begin adding support for timeline * fix some bugs with parser * fmt * add error reporting for parser * add tests for timeline query parser * add rejection tests for parse * begin adding support for lists also run migration before compiling, so schema.rs is up to date * add sqlite migration * end adding lists still miss tests and query integration * cargo fmt * try to add some tests * Add some constraint to db, and fix list test and refactor other tests to use begin_transaction * add more tests for lists * add support for lists in query executor * add keywords for including/excluding boosts and likes * cargo fmt * add function to list lists used by query will make it easier to warn users when creating timeline with unknown lists * add lang support * add timeline creation error message when using unexisting lists * Update .po files * WIP: interface for timelines * don't use diesel for migrations not sure how it passed the ci on the other branch * add some tests for timeline add an int representing the order of timelines (first one will be on top, second just under...) use first() instead of limit(1).get().into_iter().nth(0) remove migrations from build artifacts as they are now compiled in * cargo fmt * remove timeline order * fix tests * add tests for timeline creation failure * cargo fmt * add tests for timelines * add test for matching direct lists and keywords * add test for language filtering * Add a more complex test for Timeline::matches, and fix TQ::matches for TQ::Or * Make the main crate compile + FMT * Use the new timeline system - Replace the old "feed" system with timelines - Display all timelines someone can access on their home page (either their personal ones, or instance timelines) - Remove functions that were used to get user/local/federated feed - Add new posts to timelines - Create a default timeline called "My feed" for everyone, and "Local feed"/"Federated feed" with timelines @fdb-hiroshima I don't know if that's how you pictured it? If you imagined it differently I can of course make changes. I hope I didn't forgot anything… * Cargo fmt * Try to fix the migration * Fix tests * Fix the test (for real this time ?) * Fix the tests ? + fmt * Use Kind::Like and Kind::Reshare when needed * Forgot to run cargo fmt once again * revert translations * fix reviewed stuff * reduce code duplication by macros * cargo fmt
2019-10-07 17:08:20 +00:00
joinable!(list_elems -> blogs (blog_id));
joinable!(list_elems -> lists (list_id));
joinable!(list_elems -> users (user_id));
joinable!(lists -> users (user_id));
2018-06-20 18:22:34 +00:00
joinable!(mentions -> comments (comment_id));
joinable!(mentions -> posts (post_id));
joinable!(mentions -> users (mentioned_id));
2018-05-13 12:44:18 +00:00
joinable!(notifications -> users (user_id));
2018-04-23 14:37:49 +00:00
joinable!(post_authors -> posts (post_id));
joinable!(post_authors -> users (author_id));
2018-04-23 13:41:43 +00:00
joinable!(posts -> blogs (blog_id));
joinable!(posts -> medias (cover_id));
2018-05-19 09:23:02 +00:00
joinable!(reshares -> posts (post_id));
joinable!(reshares -> users (user_id));
2018-09-05 18:05:53 +00:00
joinable!(tags -> posts (post_id));
Add support for generic timeline (#525) * Begin adding support for timeline * fix some bugs with parser * fmt * add error reporting for parser * add tests for timeline query parser * add rejection tests for parse * begin adding support for lists also run migration before compiling, so schema.rs is up to date * add sqlite migration * end adding lists still miss tests and query integration * cargo fmt * try to add some tests * Add some constraint to db, and fix list test and refactor other tests to use begin_transaction * add more tests for lists * add support for lists in query executor * add keywords for including/excluding boosts and likes * cargo fmt * add function to list lists used by query will make it easier to warn users when creating timeline with unknown lists * add lang support * add timeline creation error message when using unexisting lists * Update .po files * WIP: interface for timelines * don't use diesel for migrations not sure how it passed the ci on the other branch * add some tests for timeline add an int representing the order of timelines (first one will be on top, second just under...) use first() instead of limit(1).get().into_iter().nth(0) remove migrations from build artifacts as they are now compiled in * cargo fmt * remove timeline order * fix tests * add tests for timeline creation failure * cargo fmt * add tests for timelines * add test for matching direct lists and keywords * add test for language filtering * Add a more complex test for Timeline::matches, and fix TQ::matches for TQ::Or * Make the main crate compile + FMT * Use the new timeline system - Replace the old "feed" system with timelines - Display all timelines someone can access on their home page (either their personal ones, or instance timelines) - Remove functions that were used to get user/local/federated feed - Add new posts to timelines - Create a default timeline called "My feed" for everyone, and "Local feed"/"Federated feed" with timelines @fdb-hiroshima I don't know if that's how you pictured it? If you imagined it differently I can of course make changes. I hope I didn't forgot anything… * Cargo fmt * Try to fix the migration * Fix tests * Fix the test (for real this time ?) * Fix the tests ? + fmt * Use Kind::Like and Kind::Reshare when needed * Forgot to run cargo fmt once again * revert translations * fix reviewed stuff * reduce code duplication by macros * cargo fmt
2019-10-07 17:08:20 +00:00
joinable!(timeline -> posts (post_id));
joinable!(timeline -> timeline_definition (timeline_id));
joinable!(timeline_definition -> users (user_id));
2018-04-22 18:13:12 +00:00
joinable!(users -> instances (instance_id));
allow_tables_to_appear_in_same_query!(
api_tokens,
apps,
2018-04-23 11:27:27 +00:00
blog_authors,
2018-04-23 10:29:27 +00:00
blogs,
2018-05-09 20:35:02 +00:00
comments,
comment_seers,
2022-01-29 16:16:51 +00:00
email_blocklist,
2022-01-04 13:03:47 +00:00
email_signups,
2018-05-01 13:06:31 +00:00
follows,
2018-04-22 18:13:12 +00:00
instances,
2018-05-10 15:54:35 +00:00
likes,
Add support for generic timeline (#525) * Begin adding support for timeline * fix some bugs with parser * fmt * add error reporting for parser * add tests for timeline query parser * add rejection tests for parse * begin adding support for lists also run migration before compiling, so schema.rs is up to date * add sqlite migration * end adding lists still miss tests and query integration * cargo fmt * try to add some tests * Add some constraint to db, and fix list test and refactor other tests to use begin_transaction * add more tests for lists * add support for lists in query executor * add keywords for including/excluding boosts and likes * cargo fmt * add function to list lists used by query will make it easier to warn users when creating timeline with unknown lists * add lang support * add timeline creation error message when using unexisting lists * Update .po files * WIP: interface for timelines * don't use diesel for migrations not sure how it passed the ci on the other branch * add some tests for timeline add an int representing the order of timelines (first one will be on top, second just under...) use first() instead of limit(1).get().into_iter().nth(0) remove migrations from build artifacts as they are now compiled in * cargo fmt * remove timeline order * fix tests * add tests for timeline creation failure * cargo fmt * add tests for timelines * add test for matching direct lists and keywords * add test for language filtering * Add a more complex test for Timeline::matches, and fix TQ::matches for TQ::Or * Make the main crate compile + FMT * Use the new timeline system - Replace the old "feed" system with timelines - Display all timelines someone can access on their home page (either their personal ones, or instance timelines) - Remove functions that were used to get user/local/federated feed - Add new posts to timelines - Create a default timeline called "My feed" for everyone, and "Local feed"/"Federated feed" with timelines @fdb-hiroshima I don't know if that's how you pictured it? If you imagined it differently I can of course make changes. I hope I didn't forgot anything… * Cargo fmt * Try to fix the migration * Fix tests * Fix the test (for real this time ?) * Fix the tests ? + fmt * Use Kind::Like and Kind::Reshare when needed * Forgot to run cargo fmt once again * revert translations * fix reviewed stuff * reduce code duplication by macros * cargo fmt
2019-10-07 17:08:20 +00:00
list_elems,
lists,
2018-09-02 11:34:48 +00:00
medias,
2018-06-20 18:22:34 +00:00
mentions,
2018-05-13 12:44:18 +00:00
notifications,
password_reset_requests,
2018-04-23 14:37:49 +00:00
post_authors,
2018-04-23 13:41:43 +00:00
posts,
2018-05-19 09:23:02 +00:00
reshares,
2018-09-05 18:05:53 +00:00
tags,
Add support for generic timeline (#525) * Begin adding support for timeline * fix some bugs with parser * fmt * add error reporting for parser * add tests for timeline query parser * add rejection tests for parse * begin adding support for lists also run migration before compiling, so schema.rs is up to date * add sqlite migration * end adding lists still miss tests and query integration * cargo fmt * try to add some tests * Add some constraint to db, and fix list test and refactor other tests to use begin_transaction * add more tests for lists * add support for lists in query executor * add keywords for including/excluding boosts and likes * cargo fmt * add function to list lists used by query will make it easier to warn users when creating timeline with unknown lists * add lang support * add timeline creation error message when using unexisting lists * Update .po files * WIP: interface for timelines * don't use diesel for migrations not sure how it passed the ci on the other branch * add some tests for timeline add an int representing the order of timelines (first one will be on top, second just under...) use first() instead of limit(1).get().into_iter().nth(0) remove migrations from build artifacts as they are now compiled in * cargo fmt * remove timeline order * fix tests * add tests for timeline creation failure * cargo fmt * add tests for timelines * add test for matching direct lists and keywords * add test for language filtering * Add a more complex test for Timeline::matches, and fix TQ::matches for TQ::Or * Make the main crate compile + FMT * Use the new timeline system - Replace the old "feed" system with timelines - Display all timelines someone can access on their home page (either their personal ones, or instance timelines) - Remove functions that were used to get user/local/federated feed - Add new posts to timelines - Create a default timeline called "My feed" for everyone, and "Local feed"/"Federated feed" with timelines @fdb-hiroshima I don't know if that's how you pictured it? If you imagined it differently I can of course make changes. I hope I didn't forgot anything… * Cargo fmt * Try to fix the migration * Fix tests * Fix the test (for real this time ?) * Fix the tests ? + fmt * Use Kind::Like and Kind::Reshare when needed * Forgot to run cargo fmt once again * revert translations * fix reviewed stuff * reduce code duplication by macros * cargo fmt
2019-10-07 17:08:20 +00:00
timeline,
timeline_definition,
2018-04-22 18:13:12 +00:00
users,
);