chore: regenerate entities, update downgrade.sql

This commit is contained in:
naskya 2024-03-18 00:32:48 +09:00
parent 3473442875
commit 387bfd5af8
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
2 changed files with 14 additions and 2 deletions

View file

@ -1,6 +1,7 @@
BEGIN; BEGIN;
DELETE FROM "migrations" WHERE name IN ( DELETE FROM "migrations" WHERE name IN (
'RemoveMentionedUsersColumn1710688552234',
'NoteFile1710304584214', 'NoteFile1710304584214',
'RenameMetaColumns1705944717480', 'RenameMetaColumns1705944717480',
'SeparateHardMuteWordsAndPatterns1706413792769', 'SeparateHardMuteWordsAndPatterns1706413792769',
@ -17,6 +18,19 @@ DELETE FROM "migrations" WHERE name IN (
'RemoveNativeUtilsMigration1705877093218' 'RemoveNativeUtilsMigration1705877093218'
); );
-- remove-mentioned-users-column
ALTER TABLE "note" ADD "mentionedRemoteUsers" text NOT NULL DEFAULT '[]'::text;
CREATE TABLE "temp_mentions_1710688552234" AS
SELECT "id", "url", "uri", "username", "host"
FROM "user"
JOIN "user_profile" ON "user"."id" = "user_profile". "userId" WHERE "user"."host" IS NOT NULL;
CREATE UNIQUE INDEX "temp_mentions_id" ON "temp_mentions_1710688552234" ("id");
UPDATE "note" SET "mentionedRemoteUsers" = (
SELECT COALESCE(json_agg(row_to_json("data")::jsonb - 'id')::text, '[]') FROM "temp_mentions_1710688552234" AS "data"
WHERE "data"."id" = ANY("note"."mentions")
);
DROP TABLE "temp_mentions_1710688552234";
-- note-file -- note-file
DROP TABLE "note_file"; DROP TABLE "note_file";

View file

@ -38,8 +38,6 @@ pub struct Model {
#[sea_orm(column_name = "visibleUserIds")] #[sea_orm(column_name = "visibleUserIds")]
pub visible_user_ids: Vec<String>, pub visible_user_ids: Vec<String>,
pub mentions: Vec<String>, pub mentions: Vec<String>,
#[sea_orm(column_name = "mentionedRemoteUsers", column_type = "Text")]
pub mentioned_remote_users: String,
pub emojis: Vec<String>, pub emojis: Vec<String>,
pub tags: Vec<String>, pub tags: Vec<String>,
#[sea_orm(column_name = "hasPoll")] #[sea_orm(column_name = "hasPoll")]