mirror of https://github.com/LemmyNet/lemmy.git
Merge branch 'smoosh-tables-together' of https://github.com/dullbananas/lemmy into smoosh-tables-together
commit
689d2efb48
|
@ -69,19 +69,7 @@ impl Collection for ApubCommunityModerators {
|
|||
community_id: mod_user.community.id,
|
||||
person_id: mod_user.moderator.id,
|
||||
};
|
||||
let c = CommunityModerator::leave(&mut data.pool(), &community_moderator_form).await?;
|
||||
assert_eq!(c.deleted + c.updated, 1);
|
||||
}
|
||||
}
|
||||
for mod_user in ¤t_moderators {
|
||||
let mod_id = ObjectId::from(mod_user.moderator.actor_id.clone());
|
||||
if !apub.ordered_items.contains(&mod_id) {
|
||||
let community_moderator_form = CommunityModeratorForm {
|
||||
community_id: mod_user.community.id,
|
||||
person_id: mod_user.moderator.id,
|
||||
};
|
||||
let c = CommunityModerator::leave(&mut data.pool(), &community_moderator_form).await?;
|
||||
panic!("pain");
|
||||
CommunityModerator::leave(&mut data.pool(), &community_moderator_form).await?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ impl QueryFragment<Pg> for UpleteQuery {
|
|||
out.push_sql(prefix);
|
||||
out.push_sql(" AS (");
|
||||
subquery.walk_ast(out.reborrow())?;
|
||||
out.push_sql(" )");
|
||||
out.push_sql(" FOR UPDATE)");
|
||||
}
|
||||
|
||||
// Update rows that are referenced in `update_keys`
|
||||
|
@ -151,13 +151,11 @@ impl QueryFragment<Pg> for UpleteQuery {
|
|||
self.table.walk_ast(out.reborrow())?;
|
||||
out.push_sql(" WHERE (");
|
||||
self.primary_key.walk_ast(out.reborrow())?;
|
||||
out.push_sql(") = ANY (SELECT * FROM update_keys) RETURNING 1)");
|
||||
out.push_sql(") = ANY (SELECT * FROM delete_keys) RETURNING 1)");
|
||||
|
||||
// Count updated rows and deleted rows (`RETURNING 1` makes this possible)
|
||||
//out.push_sql(" SELECT (SELECT count(*) FROM update_result)");
|
||||
//out.push_sql(", (SELECT count(*) FROM delete_result)");
|
||||
out.push_sql(" SELECT (SELECT count(*) FROM update_keys)");
|
||||
out.push_sql(", (SELECT count(*) FROM delete_keys)");
|
||||
out.push_sql(" SELECT (SELECT count(*) FROM update_result)");
|
||||
out.push_sql(", (SELECT count(*) FROM delete_result)");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -40,13 +40,11 @@ impl CommunityModeratorView {
|
|||
pool: &mut DbPool<'_>,
|
||||
community_id: CommunityId,
|
||||
) -> Result<Vec<Self>, Error> {
|
||||
use diesel::NullableExpressionMethods;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
action_query(community_actions::became_moderator)
|
||||
.inner_join(community::table)
|
||||
.inner_join(person::table)
|
||||
.filter(community_actions::community_id.eq(community_id))
|
||||
.filter(community_actions::became_moderator.is_not_null())
|
||||
.select((community::all_columns, person::all_columns))
|
||||
.order_by(community_actions::became_moderator)
|
||||
.load::<CommunityModeratorView>(conn)
|
||||
|
|
|
@ -254,14 +254,10 @@ ALTER INDEX comment_actions_pkey RENAME TO comment_like_pkey;
|
|||
|
||||
ALTER INDEX idx_comment_actions_comment RENAME TO idx_comment_like_comment;
|
||||
|
||||
ALTER INDEX idx_comment_actions_post RENAME TO idx_comment_like_post;
|
||||
|
||||
ALTER TABLE comment_like RENAME CONSTRAINT comment_actions_comment_id_fkey TO comment_like_comment_id_fkey;
|
||||
|
||||
ALTER TABLE comment_like RENAME CONSTRAINT comment_actions_person_id_fkey TO comment_like_person_id_fkey;
|
||||
|
||||
ALTER TABLE comment_like RENAME CONSTRAINT comment_actions_post_id_fkey TO comment_like_post_id_fkey;
|
||||
|
||||
ALTER INDEX community_actions_pkey RENAME TO community_follower_pkey;
|
||||
|
||||
ALTER INDEX idx_community_actions_community RENAME TO idx_community_follower_community;
|
||||
|
@ -298,8 +294,6 @@ CREATE INDEX idx_comment_saved_comment ON comment_saved (comment_id);
|
|||
|
||||
CREATE INDEX idx_comment_saved_person ON comment_saved (person_id);
|
||||
|
||||
CREATE INDEX idx_comment_like_post ON comment_like (post_id);
|
||||
|
||||
CREATE INDEX idx_community_block_community ON community_block (community_id);
|
||||
|
||||
CREATE INDEX idx_community_moderator_community ON community_moderator (community_id);
|
|
@ -53,7 +53,7 @@ ALTER TABLE community_actions
|
|||
ADD COLUMN received_ban timestamptz,
|
||||
ADD COLUMN ban_expires timestamptz,
|
||||
ADD CONSTRAINT community_actions_check_followed CHECK ((followed IS NULL) = (follow_pending IS NULL)),
|
||||
ADD CONSTRAINT community_actions_check_received_ban CHECK ((received_ban IS NULL, ban_expires IS NULL) != (TRUE, FALSE));
|
||||
ADD CONSTRAINT community_actions_check_received_ban CHECK (NOT (received_ban IS NULL AND ban_expires IS NOT NULL));
|
||||
|
||||
ALTER TABLE instance_actions
|
||||
ALTER COLUMN blocked DROP NOT NULL,
|
Loading…
Reference in New Issue