Merge branch 'cw-text' into 'develop'

Increase CW character limit

Closes #10876

See merge request firefish/firefish!10746
This commit is contained in:
naskya 2024-04-17 20:47:40 +00:00
commit 4b7724ed1f
5 changed files with 31 additions and 4 deletions

View file

@ -1,6 +1,7 @@
BEGIN;
DELETE FROM "migrations" WHERE name IN (
'ConvertCwVarcharToText1713225866247',
'FixChatFileConstraint1712855579316',
'DropTimeZone1712425488543',
'ExpandNoteEdit1711936358554',
@ -22,6 +23,11 @@ DELETE FROM "migrations" WHERE name IN (
'RemoveNativeUtilsMigration1705877093218'
);
--convert-cw-varchar-to-text
DROP INDEX "IDX_8e3bbbeb3df04d1a8105da4c8f";
ALTER TABLE "note" ALTER COLUMN "cw" TYPE character varying(512);
CREATE INDEX "IDX_8e3bbbeb3df04d1a8105da4c8f" ON "note" USING "pgroonga" ("cw" pgroonga_varchar_full_text_search_ops_v2);
-- fix-chat-file-constraint
ALTER TABLE "messaging_message" DROP CONSTRAINT "FK_535def119223ac05ad3fa9ef64b";
ALTER TABLE "messaging_message" ADD CONSTRAINT "FK_535def119223ac05ad3fa9ef64b" FOREIGN KEY ("fileId") REFERENCES "drive_file"("id") ON DELETE CASCADE ON UPDATE NO ACTION;

View file

@ -21,6 +21,7 @@ pub struct Model {
#[sea_orm(column_type = "Text", nullable)]
pub text: Option<String>,
pub name: Option<String>,
#[sea_orm(column_type = "Text", nullable)]
pub cw: Option<String>,
#[sea_orm(column_name = "userId")]
pub user_id: String,

View file

@ -0,0 +1,21 @@
import type { MigrationInterface, QueryRunner } from "typeorm";
export class ConvertCwVarcharToText1713225866247 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
queryRunner.query(`DROP INDEX "IDX_8e3bbbeb3df04d1a8105da4c8f"`);
queryRunner.query(`ALTER TABLE "note" ALTER COLUMN "cw" TYPE text`);
queryRunner.query(
`CREATE INDEX "IDX_8e3bbbeb3df04d1a8105da4c8f" ON "note" USING "pgroonga" ("cw")`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
queryRunner.query(`DROP INDEX "IDX_8e3bbbeb3df04d1a8105da4c8f"`);
queryRunner.query(
`ALTER TABLE "note" ALTER COLUMN "cw" TYPE character varying(512)`,
);
queryRunner.query(
`CREATE INDEX "IDX_8e3bbbeb3df04d1a8105da4c8f" ON "note" USING "pgroonga" ("cw" pgroonga_varchar_full_text_search_ops_v2)`,
);
}
}

View file

@ -72,9 +72,8 @@ export class Note {
})
public name: string | null;
@Index() // USING pgroonga pgroonga_varchar_full_text_search_ops_v2
@Column("varchar", {
length: 512,
@Index() // USING pgroonga
@Column("text", {
nullable: true,
})
public cw: string | null;

View file

@ -114,7 +114,7 @@ export const paramDef = {
enum: Object.keys(langmap),
nullable: true,
},
cw: { type: "string", nullable: true, maxLength: 100 },
cw: { type: "string", nullable: true, maxLength: MAX_NOTE_TEXT_LENGTH },
localOnly: { type: "boolean", default: false },
noExtractMentions: { type: "boolean", default: false },
noExtractHashtags: { type: "boolean", default: false },