make column mandatory

This commit is contained in:
Felix Ableitner 2024-05-30 11:05:47 +02:00
parent 1e9cb61002
commit fb7782ce12
5 changed files with 11 additions and 9 deletions

View file

@ -877,7 +877,7 @@ diesel::table! {
send_community_followers_of -> Nullable<Int4>, send_community_followers_of -> Nullable<Int4>,
send_all_instances -> Bool, send_all_instances -> Bool,
actor_type -> ActorTypeEnum, actor_type -> ActorTypeEnum,
actor_apub_id -> Nullable<Text>, actor_apub_id -> Text,
} }
} }

View file

@ -65,7 +65,7 @@ pub struct SentActivity {
pub send_community_followers_of: Option<CommunityId>, pub send_community_followers_of: Option<CommunityId>,
pub send_all_instances: bool, pub send_all_instances: bool,
pub actor_type: ActorType, pub actor_type: ActorType,
pub actor_apub_id: Option<DbUrl>, pub actor_apub_id: DbUrl,
} }
#[cfg_attr(feature = "full", derive(Insertable))] #[cfg_attr(feature = "full", derive(Insertable))]

View file

@ -188,11 +188,11 @@ impl InstanceWorker {
self.state.last_successful_published_time = Some(activity.published); self.state.last_successful_published_time = Some(activity.published);
return Ok(()); return Ok(());
} }
// TODO: make db column not null let actor = get_actor_cached(
let Some(actor_apub_id) = &activity.actor_apub_id else { &mut self.context.pool(),
return Ok(()); // activity was inserted before persistent queue was activated activity.actor_type,
}; &activity.actor_apub_id,
let actor = get_actor_cached(&mut self.context.pool(), activity.actor_type, actor_apub_id) )
.await .await
.context("failed getting actor instance (was it marked deleted / removed?)")?; .context("failed getting actor instance (was it marked deleted / removed?)")?;

View file

@ -0,0 +1 @@
ALTER TABLE sent_activity ALTER COLUMN actor_apub_id DROP NOT NULL;

View file

@ -0,0 +1 @@
ALTER TABLE sent_activity ALTER COLUMN actor_apub_id SET NOT NULL;