feat (backend): increase CW character limit (close #10876)
This commit is contained in:
parent
77a2bcfc4b
commit
07384a4f0f
5 changed files with 31 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)`,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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 },
|
||||
|
|
Loading…
Reference in a new issue