tweak postgresql entities

Fix #10266
This commit is contained in:
syuilo 2023-03-10 14:53:56 +09:00
parent 258bd3c905
commit 99f3f0917f
10 changed files with 137 additions and 82 deletions

View file

@ -19,10 +19,13 @@ You should also include the user name that made the change.
- enhance(client): フォロー申請のボタンのデザインを改善
- enhance(backend): OpenAPIエンドポイントを復旧
- 透明なWebP/AVIF映像はJPEGではなくWebPに変換するように
- アクティブユーザー数チャートの記録上限値を拡張
- Playのソースコード上限文字数を2倍に拡張
### Bugfixes
- ロールで広告を無効にするとadmin/adsでプレビューがでてこない問題を修正
- /api-consoleページにアクセスすると404が出る問題を修正
- SMTP Login id length is too short
## 13.9.2 (2023/03/06)

View file

@ -0,0 +1,68 @@
export class tweakVarcharLength1678426061773 {
name = 'tweakVarcharLength1678426061773'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "name" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "maintainerName" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "maintainerEmail" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "langs" TYPE character varying(1024) array`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "pinnedUsers" TYPE character varying(1024) array`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "hiddenTags" TYPE character varying(1024) array`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "blockedHosts" TYPE character varying(1024) array`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "themeColor" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "mascotImageUrl" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "bannerUrl" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "backgroundImageUrl" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "logoImageUrl" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "errorImageUrl" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "iconUrl" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "hcaptchaSiteKey" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "hcaptchaSecretKey" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "recaptchaSiteKey" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "recaptchaSecretKey" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "turnstileSiteKey" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "turnstileSecretKey" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "summalyProxy" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "email" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "smtpHost" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "smtpUser" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "smtpPass" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "swPublicKey" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "swPrivateKey" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "deeplAuthKey" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" RENAME COLUMN "ToSUrl" TO "termsOfServiceUrl"`);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "termsOfServiceUrl" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "repositoryUrl" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "feedbackUrl" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "objectStorageBucket" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "objectStoragePrefix" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "objectStorageBaseUrl" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "objectStorageEndpoint" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "objectStorageRegion" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "objectStorageAccessKey" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "objectStorageSecretKey" TYPE character varying(1024)`, undefined);
await queryRunner.query(`ALTER TABLE "flash" ALTER COLUMN "script" TYPE character varying(65536)`, undefined);
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___readWrite" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___read" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___write" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___registeredWithinWeek" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___registeredWithinMonth" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___registeredWithinYear" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___registeredOutsideWeek" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___registeredOutsideMonth" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart__active_users" ALTER COLUMN "___registeredOutsideYear" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___readWrite" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___read" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___write" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___registeredWithinWeek" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___registeredWithinMonth" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___registeredWithinYear" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___registeredOutsideWeek" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___registeredOutsideMonth" TYPE integer`);
await queryRunner.query(`ALTER TABLE "__chart_day__active_users" ALTER COLUMN "___registeredOutsideYear" TYPE integer`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" RENAME COLUMN "termsOfServiceUrl" TO "ToSUrl"`);
}
}

View file

@ -0,0 +1,13 @@
export class removeUnused1678427401214 {
name = 'removeUnused1678427401214'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedPages"`);
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedClipId"`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" ADD "pinnedClipId" character varying(32)`);
await queryRunner.query(`ALTER TABLE "meta" ADD "pinnedPages" character varying(512) array NOT NULL DEFAULT '{/featured,/channels,/explore,/pages,/about-misskey}'`);
}
}

View file

@ -3,15 +3,15 @@ import Chart from '../../core.js';
export const name = 'activeUsers';
export const schema = {
'readWrite': { intersection: ['read', 'write'], range: 'small' },
'read': { uniqueIncrement: true, range: 'small' },
'write': { uniqueIncrement: true, range: 'small' },
'registeredWithinWeek': { uniqueIncrement: true, range: 'small' },
'registeredWithinMonth': { uniqueIncrement: true, range: 'small' },
'registeredWithinYear': { uniqueIncrement: true, range: 'small' },
'registeredOutsideWeek': { uniqueIncrement: true, range: 'small' },
'registeredOutsideMonth': { uniqueIncrement: true, range: 'small' },
'registeredOutsideYear': { uniqueIncrement: true, range: 'small' },
'readWrite': { intersection: ['read', 'write'] },
'read': { uniqueIncrement: true },
'write': { uniqueIncrement: true },
'registeredWithinWeek': { uniqueIncrement: true },
'registeredWithinMonth': { uniqueIncrement: true },
'registeredWithinYear': { uniqueIncrement: true },
'registeredOutsideWeek': { uniqueIncrement: true },
'registeredOutsideMonth': { uniqueIncrement: true },
'registeredOutsideYear': { uniqueIncrement: true },
} as const;
export const entity = Chart.schemaToEntity(name, schema);

View file

@ -43,7 +43,7 @@ export class Flash {
public user: User | null;
@Column('varchar', {
length: 32768,
length: 65536,
})
public script: string;

View file

@ -12,7 +12,7 @@ export class Meta {
public id: string;
@Column('varchar', {
length: 128, nullable: true,
length: 1024, nullable: true,
})
public name: string | null;
@ -25,7 +25,7 @@ export class Meta {
*
*/
@Column('varchar', {
length: 128, nullable: true,
length: 1024, nullable: true,
})
public maintainerName: string | null;
@ -33,7 +33,7 @@ export class Meta {
*
*/
@Column('varchar', {
length: 128, nullable: true,
length: 1024, nullable: true,
})
public maintainerEmail: string | null;
@ -48,76 +48,63 @@ export class Meta {
public useStarForReactionFallback: boolean;
@Column('varchar', {
length: 64, array: true, default: '{}',
length: 1024, array: true, default: '{}',
})
public langs: string[];
@Column('varchar', {
length: 256, array: true, default: '{}',
length: 1024, array: true, default: '{}',
})
public pinnedUsers: string[];
@Column('varchar', {
length: 256, array: true, default: '{}',
length: 1024, array: true, default: '{}',
})
public hiddenTags: string[];
@Column('varchar', {
length: 256, array: true, default: '{}',
length: 1024, array: true, default: '{}',
})
public blockedHosts: string[];
@Column('varchar', {
length: 512, array: true, default: '{/featured,/channels,/explore,/pages,/about-misskey}',
})
public pinnedPages: string[];
@Column({
...id(),
nullable: true,
})
public pinnedClipId: Clip['id'] | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public themeColor: string | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
default: '/assets/ai.png',
})
public mascotImageUrl: string | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public bannerUrl: string | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public backgroundImageUrl: string | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public logoImageUrl: string | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
default: 'https://xn--931a.moe/aiart/yubitun.png',
})
public errorImageUrl: string | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public iconUrl: string | null;
@ -150,13 +137,13 @@ export class Meta {
public enableHcaptcha: boolean;
@Column('varchar', {
length: 64,
length: 1024,
nullable: true,
})
public hcaptchaSiteKey: string | null;
@Column('varchar', {
length: 64,
length: 1024,
nullable: true,
})
public hcaptchaSecretKey: string | null;
@ -167,13 +154,13 @@ export class Meta {
public enableRecaptcha: boolean;
@Column('varchar', {
length: 64,
length: 1024,
nullable: true,
})
public recaptchaSiteKey: string | null;
@Column('varchar', {
length: 64,
length: 1024,
nullable: true,
})
public recaptchaSecretKey: string | null;
@ -184,13 +171,13 @@ export class Meta {
public enableTurnstile: boolean;
@Column('varchar', {
length: 64,
length: 1024,
nullable: true,
})
public turnstileSiteKey: string | null;
@Column('varchar', {
length: 64,
length: 1024,
nullable: true,
})
public turnstileSecretKey: string | null;
@ -218,7 +205,7 @@ export class Meta {
public enableSensitiveMediaDetectionForVideos: boolean;
@Column('varchar', {
length: 128,
length: 1024,
nullable: true,
})
public summalyProxy: string | null;
@ -229,7 +216,7 @@ export class Meta {
public enableEmail: boolean;
@Column('varchar', {
length: 128,
length: 1024,
nullable: true,
})
public email: string | null;
@ -240,7 +227,7 @@ export class Meta {
public smtpSecure: boolean;
@Column('varchar', {
length: 128,
length: 1024,
nullable: true,
})
public smtpHost: string | null;
@ -251,13 +238,13 @@ export class Meta {
public smtpPort: number | null;
@Column('varchar', {
length: 128,
length: 1024,
nullable: true,
})
public smtpUser: string | null;
@Column('varchar', {
length: 128,
length: 1024,
nullable: true,
})
public smtpPass: string | null;
@ -268,19 +255,19 @@ export class Meta {
public enableServiceWorker: boolean;
@Column('varchar', {
length: 128,
length: 1024,
nullable: true,
})
public swPublicKey: string | null;
@Column('varchar', {
length: 128,
length: 1024,
nullable: true,
})
public swPrivateKey: string | null;
@Column('varchar', {
length: 128,
length: 1024,
nullable: true,
})
public deeplAuthKey: string | null;
@ -291,20 +278,20 @@ export class Meta {
public deeplIsPro: boolean;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public ToSUrl: string | null;
public termsOfServiceUrl: string | null;
@Column('varchar', {
length: 512,
length: 1024,
default: 'https://github.com/misskey-dev/misskey',
nullable: false,
})
public repositoryUrl: string;
@Column('varchar', {
length: 512,
length: 1024,
default: 'https://github.com/misskey-dev/misskey/issues/new',
nullable: true,
})
@ -328,43 +315,43 @@ export class Meta {
public useObjectStorage: boolean;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public objectStorageBucket: string | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public objectStoragePrefix: string | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public objectStorageBaseUrl: string | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public objectStorageEndpoint: string | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public objectStorageRegion: string | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public objectStorageAccessKey: string | null;
@Column('varchar', {
length: 512,
length: 1024,
nullable: true,
})
public objectStorageSecretKey: string | null;

View file

@ -100,7 +100,7 @@ export class NodeinfoServerService {
email: meta.maintainerEmail,
},
langs: meta.langs,
tosUrl: meta.ToSUrl,
tosUrl: meta.termsOfServiceUrl,
repositoryUrl: meta.repositoryUrl,
feedbackUrl: meta.feedbackUrl,
disableRegistration: meta.disableRegistration,

View file

@ -266,7 +266,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
uri: this.config.url,
description: instance.description,
langs: instance.langs,
tosUrl: instance.ToSUrl,
tosUrl: instance.termsOfServiceUrl,
repositoryUrl: instance.repositoryUrl,
feedbackUrl: instance.feedbackUrl,
disableRegistration: instance.disableRegistration,
@ -290,8 +290,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
enableEmail: instance.enableEmail,
enableServiceWorker: instance.enableServiceWorker,
translatorAvailable: instance.deeplAuthKey != null,
pinnedPages: instance.pinnedPages,
pinnedClipId: instance.pinnedClipId,
cacheRemoteFiles: instance.cacheRemoteFiles,
useStarForReactionFallback: instance.useStarForReactionFallback,
pinnedUsers: instance.pinnedUsers,

View file

@ -56,10 +56,6 @@ export const paramDef = {
proxyAccountId: { type: 'string', format: 'misskey:id', nullable: true },
maintainerName: { type: 'string', nullable: true },
maintainerEmail: { type: 'string', nullable: true },
pinnedPages: { type: 'array', items: {
type: 'string',
} },
pinnedClipId: { type: 'string', format: 'misskey:id', nullable: true },
langs: { type: 'array', items: {
type: 'string',
} },
@ -247,14 +243,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
set.langs = ps.langs.filter(Boolean);
}
if (Array.isArray(ps.pinnedPages)) {
set.pinnedPages = ps.pinnedPages.filter(Boolean);
}
if (ps.pinnedClipId !== undefined) {
set.pinnedClipId = ps.pinnedClipId;
}
if (ps.summalyProxy !== undefined) {
set.summalyProxy = ps.summalyProxy;
}
@ -304,7 +292,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
}
if (ps.tosUrl !== undefined) {
set.ToSUrl = ps.tosUrl;
set.termsOfServiceUrl = ps.tosUrl;
}
if (ps.repositoryUrl !== undefined) {

View file

@ -276,7 +276,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
uri: this.config.url,
description: instance.description,
langs: instance.langs,
tosUrl: instance.ToSUrl,
tosUrl: instance.termsOfServiceUrl,
repositoryUrl: instance.repositoryUrl,
feedbackUrl: instance.feedbackUrl,
disableRegistration: instance.disableRegistration,
@ -315,8 +315,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
mediaProxy: this.config.mediaProxy,
...(ps.detail ? {
pinnedPages: instance.pinnedPages,
pinnedClipId: instance.pinnedClipId,
cacheRemoteFiles: instance.cacheRemoteFiles,
requireSetup: (await this.usersRepository.countBy({
host: IsNull(),