mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-09-02 11:13:51 +00:00
Fix migration local_image_person (#5799)
This commit is contained in:
parent
070d049c49
commit
9a84180b5a
3 changed files with 3 additions and 7 deletions
|
@ -25,7 +25,7 @@ use {
|
|||
pub struct LocalImage {
|
||||
pub pictrs_alias: String,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub person_id: PersonId,
|
||||
pub person_id: Option<PersonId>,
|
||||
/// This means the image is an auto-generated thumbnail, for a post.
|
||||
pub thumbnail_for_post_id: Option<PostId>,
|
||||
}
|
||||
|
|
|
@ -395,7 +395,7 @@ diesel::table! {
|
|||
local_image (pictrs_alias) {
|
||||
pictrs_alias -> Text,
|
||||
published_at -> Timestamptz,
|
||||
person_id -> Int4,
|
||||
person_id -> Nullable<Int4>,
|
||||
thumbnail_for_post_id -> Nullable<Int4>,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
--
|
||||
-- See https://github.com/LemmyNet/lemmy/issues/5564
|
||||
ALTER TABLE local_image
|
||||
ADD COLUMN person_id int NOT NULL DEFAULT 0 REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
ADD COLUMN person_id int REFERENCES person (id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
ADD COLUMN thumbnail_for_post_id int REFERENCES post (id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
|
||||
-- Update historical person_id columns
|
||||
|
@ -19,10 +19,6 @@ FROM
|
|||
WHERE
|
||||
li.local_user_id = lu.id;
|
||||
|
||||
-- Remove the default
|
||||
ALTER TABLE local_image
|
||||
ALTER COLUMN person_id DROP DEFAULT;
|
||||
|
||||
-- Remove the local_user_id column
|
||||
ALTER TABLE local_image
|
||||
DROP COLUMN local_user_id;
|
||||
|
|
Loading…
Reference in a new issue