Initial commit
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
declare module "hcaptcha" {
|
||||
interface IVerifyResponse {
|
||||
success: boolean;
|
||||
challenge_ts: string;
|
||||
hostname: string;
|
||||
credit?: boolean;
|
||||
"error-codes"?: unknown[];
|
||||
}
|
||||
|
||||
export function verify(
|
||||
secret: string,
|
||||
token: string,
|
||||
): Promise<IVerifyResponse>;
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
declare module "@peertube/http-signature" {
|
||||
import type { IncomingMessage, ClientRequest } from "node:http";
|
||||
|
||||
interface ISignature {
|
||||
keyId: string;
|
||||
algorithm: string;
|
||||
headers: string[];
|
||||
signature: string;
|
||||
}
|
||||
|
||||
interface IOptions {
|
||||
headers?: string[];
|
||||
algorithm?: string;
|
||||
strict?: boolean;
|
||||
authorizationHeaderName?: string;
|
||||
}
|
||||
|
||||
interface IParseRequestOptions extends IOptions {
|
||||
clockSkew?: number;
|
||||
}
|
||||
|
||||
interface IParsedSignature {
|
||||
scheme: string;
|
||||
params: ISignature;
|
||||
signingString: string;
|
||||
algorithm: string;
|
||||
keyId: string;
|
||||
}
|
||||
|
||||
type RequestSignerConstructorOptions =
|
||||
| IRequestSignerConstructorOptionsFromProperties
|
||||
| IRequestSignerConstructorOptionsFromFunction;
|
||||
|
||||
interface IRequestSignerConstructorOptionsFromProperties {
|
||||
keyId: string;
|
||||
key: string | Buffer;
|
||||
algorithm?: string;
|
||||
}
|
||||
|
||||
interface IRequestSignerConstructorOptionsFromFunction {
|
||||
sign?: (data: string, cb: (err: any, sig: ISignature) => void) => void;
|
||||
}
|
||||
|
||||
class RequestSigner {
|
||||
constructor(options: RequestSignerConstructorOptions);
|
||||
|
||||
public writeHeader(header: string, value: string): string;
|
||||
|
||||
public writeDateHeader(): string;
|
||||
|
||||
public writeTarget(method: string, path: string): void;
|
||||
|
||||
public sign(cb: (err: any, authz: string) => void): void;
|
||||
}
|
||||
|
||||
interface ISignRequestOptions extends IOptions {
|
||||
keyId: string;
|
||||
key: string;
|
||||
httpVersion?: string;
|
||||
}
|
||||
|
||||
export function parse(
|
||||
request: IncomingMessage,
|
||||
options?: IParseRequestOptions,
|
||||
): IParsedSignature;
|
||||
export function parseRequest(
|
||||
request: IncomingMessage,
|
||||
options?: IParseRequestOptions,
|
||||
): IParsedSignature;
|
||||
|
||||
export function sign(
|
||||
request: ClientRequest,
|
||||
options: ISignRequestOptions,
|
||||
): boolean;
|
||||
export function signRequest(
|
||||
request: ClientRequest,
|
||||
options: ISignRequestOptions,
|
||||
): boolean;
|
||||
export function createSigner(): RequestSigner;
|
||||
export function isSigner(obj: any): obj is RequestSigner;
|
||||
|
||||
export function sshKeyToPEM(key: string): string;
|
||||
export function sshKeyFingerprint(key: string): string;
|
||||
export function pemToRsaSSHKey(pem: string, comment: string): string;
|
||||
|
||||
export function verify(
|
||||
parsedSignature: IParsedSignature,
|
||||
pubkey: string | Buffer,
|
||||
): boolean;
|
||||
export function verifySignature(
|
||||
parsedSignature: IParsedSignature,
|
||||
pubkey: string | Buffer,
|
||||
): boolean;
|
||||
export function verifyHMAC(
|
||||
parsedSignature: IParsedSignature,
|
||||
secret: string,
|
||||
): boolean;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
declare module "koa-remove-trailing-slashes";
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
declare module "koa-slow" {
|
||||
import type { Middleware } from "koa";
|
||||
|
||||
interface ISlowOptions {
|
||||
url?: RegExp;
|
||||
delay?: number;
|
||||
}
|
||||
|
||||
function slow(options?: ISlowOptions): Middleware;
|
||||
|
||||
namespace slow {} // Hack
|
||||
|
||||
export = slow;
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
declare module "os-utils" {
|
||||
type FreeCommandCallback = (usedmem: number) => void;
|
||||
|
||||
type HarddriveCallback = (total: number, free: number, used: number) => void;
|
||||
|
||||
type GetProcessesCallback = (result: string) => void;
|
||||
|
||||
type CPUCallback = (perc: number) => void;
|
||||
|
||||
export function platform(): NodeJS.Platform;
|
||||
export function cpuCount(): number;
|
||||
export function sysUptime(): number;
|
||||
export function processUptime(): number;
|
||||
|
||||
export function freemem(): number;
|
||||
export function totalmem(): number;
|
||||
export function freememPercentage(): number;
|
||||
export function freeCommand(callback: FreeCommandCallback): void;
|
||||
|
||||
export function harddrive(callback: HarddriveCallback): void;
|
||||
|
||||
export function getProcesses(callback: GetProcessesCallback): void;
|
||||
export function getProcesses(
|
||||
nProcess: number,
|
||||
callback: GetProcessesCallback,
|
||||
): void;
|
||||
|
||||
export function allLoadavg(): string;
|
||||
export function loadavg(_time?: number): number;
|
||||
|
||||
export function cpuFree(callback: CPUCallback): void;
|
||||
export function cpuUsage(callback: CPUCallback): void;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
declare module "*/package.json" {
|
||||
interface IRepository {
|
||||
type: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export const name: string;
|
||||
export const version: string;
|
||||
export const repository: IRepository;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import cluster from "node:cluster";
|
||||
import chalk from "chalk";
|
||||
import Xev from "xev";
|
||||
|
||||
import Logger from "@/services/logger.js";
|
||||
import { envOption } from "../env.js";
|
||||
|
||||
// for typeorm
|
||||
import "reflect-metadata";
|
||||
import { masterMain } from "./master.js";
|
||||
import { workerMain } from "./worker.js";
|
||||
import os from "node:os";
|
||||
import { isIgnorableConnectionError } from "@/server/is-ignorable-connection-error.js";
|
||||
|
||||
const logger = new Logger("core", "cyan");
|
||||
const clusterLogger = logger.createSubLogger("cluster", "orange", false);
|
||||
const ev = new Xev();
|
||||
|
||||
/**
|
||||
* Init process
|
||||
*/
|
||||
export default async function () {
|
||||
process.title = `FrozenFriendsYume (${cluster.isPrimary ? "master" : "worker"})`;
|
||||
|
||||
if (cluster.isPrimary || envOption.disableClustering) {
|
||||
await masterMain();
|
||||
if (cluster.isPrimary) {
|
||||
ev.mount();
|
||||
}
|
||||
}
|
||||
|
||||
if (cluster.isWorker || envOption.disableClustering) {
|
||||
await workerMain();
|
||||
}
|
||||
|
||||
if (cluster.isPrimary) {
|
||||
// Leave the master process with a marginally lower priority but not too low.
|
||||
os.setPriority(2);
|
||||
}
|
||||
if (cluster.isWorker) {
|
||||
// Set workers to a much lower priority so that the master process will be
|
||||
// able to respond to api calls even if the workers gank everything.
|
||||
os.setPriority(10);
|
||||
}
|
||||
|
||||
// For when FrozenFriendsYume is started in a child process during unit testing.
|
||||
// Otherwise, process.send cannot be used, so start it.
|
||||
if (process.send) {
|
||||
process.send("ok");
|
||||
}
|
||||
}
|
||||
|
||||
//#region Events
|
||||
|
||||
// Listen new workers
|
||||
cluster.on("fork", (worker) => {
|
||||
clusterLogger.debug(`Process forked: [${worker.id}]`);
|
||||
});
|
||||
|
||||
// Listen online workers
|
||||
cluster.on("online", (worker) => {
|
||||
clusterLogger.debug(`Process is now online: [${worker.id}]`);
|
||||
});
|
||||
|
||||
// Listen for dying workers
|
||||
cluster.on("exit", (worker) => {
|
||||
// Replace the dead worker,
|
||||
// we're not sentimental
|
||||
clusterLogger.error(chalk.red(`[${worker.id}] died :(`));
|
||||
cluster.fork();
|
||||
});
|
||||
|
||||
// Display detail of unhandled promise rejection
|
||||
if (!envOption.quiet) {
|
||||
process.on("unhandledRejection", (err) => {
|
||||
if (isIgnorableConnectionError(err)) return;
|
||||
console.dir(err);
|
||||
});
|
||||
}
|
||||
|
||||
// Display detail of uncaught exception
|
||||
process.on("uncaughtException", (err) => {
|
||||
if (isIgnorableConnectionError(err)) return;
|
||||
try {
|
||||
logger.error(err);
|
||||
} catch {}
|
||||
});
|
||||
|
||||
// Dying away...
|
||||
process.on("exit", (code) => {
|
||||
logger.info(`The process is going to exit with code ${code}`);
|
||||
});
|
||||
|
||||
//#endregion
|
||||
@@ -0,0 +1,197 @@
|
||||
import * as fs from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { dirname } from "node:path";
|
||||
import * as os from "node:os";
|
||||
import cluster from "node:cluster";
|
||||
import net from "node:net";
|
||||
import repl from "node:repl";
|
||||
import chalk from "chalk";
|
||||
import chalkTemplate from "chalk-template";
|
||||
import semver from "semver";
|
||||
|
||||
import Logger from "@/services/logger.js";
|
||||
import loadConfig from "@/config/load.js";
|
||||
import type { Config } from "@/config/types.js";
|
||||
import { lessThan } from "@/prelude/array.js";
|
||||
import { envOption } from "../env.js";
|
||||
import { showMachineInfo } from "@/misc/show-machine-info.js";
|
||||
import { db, initDb } from "../db/postgre.js";
|
||||
|
||||
const _filename = fileURLToPath(import.meta.url);
|
||||
const _dirname = dirname(_filename);
|
||||
|
||||
const meta = JSON.parse(
|
||||
fs.readFileSync(`${_dirname}/../../../../built/meta.json`, "utf-8"),
|
||||
);
|
||||
|
||||
const logger = new Logger("core", "cyan");
|
||||
const bootLogger = logger.createSubLogger("boot", "magenta", false);
|
||||
|
||||
const themeColor = chalk.hex("#31748f");
|
||||
|
||||
function greet() {
|
||||
if (!envOption.quiet) {
|
||||
console.log(
|
||||
chalkTemplate`--- ${os.hostname()} {gray (PID: ${process.pid.toString()})} ---`,
|
||||
);
|
||||
}
|
||||
|
||||
const displayVersion = meta.version.startsWith("v") ? meta.version : `v${meta.version}`;
|
||||
bootLogger.info(`FrozenFriendsYume ${displayVersion}, initializing...`, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init master process
|
||||
*/
|
||||
export async function masterMain() {
|
||||
let config!: Config;
|
||||
|
||||
// initialize app
|
||||
try {
|
||||
greet();
|
||||
showEnvironment();
|
||||
await showMachineInfo(bootLogger);
|
||||
showNodejsVersion();
|
||||
config = loadConfigBoot();
|
||||
await connectDb();
|
||||
if (config.shellAddress !== undefined)
|
||||
spawnShell(config.shellAddress);
|
||||
} catch (e) {
|
||||
bootLogger.error("Fatal error occurred during initialization", null, true);
|
||||
bootLogger.error(e);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
bootLogger.succ("FrozenFriendsYume initialized");
|
||||
|
||||
if (!envOption.disableClustering) {
|
||||
await spawnWorkers(config.clusterLimit);
|
||||
}
|
||||
|
||||
bootLogger.succ(
|
||||
`Now listening on port ${config.port} on ${config.url} - using ${config.domain}`,
|
||||
null,
|
||||
true,
|
||||
);
|
||||
|
||||
if (!envOption.noDaemons && !config.onlyQueueProcessor) {
|
||||
import("../daemons/server-stats.js").then((x) => x.default());
|
||||
import("../daemons/queue-stats.js").then((x) => x.default());
|
||||
import("../daemons/janitor.js").then((x) => x.default());
|
||||
}
|
||||
}
|
||||
|
||||
function showEnvironment(): void {
|
||||
const env = process.env.NODE_ENV;
|
||||
const logger = bootLogger.createSubLogger("env");
|
||||
logger.info(
|
||||
typeof env === "undefined" ? "NODE_ENV is not set" : `NODE_ENV: ${env}`,
|
||||
);
|
||||
|
||||
if (env !== "production") {
|
||||
logger.warn("The environment is not in production mode.");
|
||||
logger.warn("DO NOT USE FOR PRODUCTION PURPOSE!", null, true);
|
||||
}
|
||||
}
|
||||
|
||||
function showNodejsVersion(): void {
|
||||
const nodejsLogger = bootLogger.createSubLogger("nodejs");
|
||||
|
||||
nodejsLogger.info(`Version ${process.version} detected.`);
|
||||
|
||||
const minVersion = fs
|
||||
.readFileSync(`${_dirname}/../../../../.node-version`, "utf-8")
|
||||
.trim();
|
||||
if (semver.lt(process.version, minVersion)) {
|
||||
nodejsLogger.error(`At least Node.js ${minVersion} required!`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
function loadConfigBoot(): Config {
|
||||
const configLogger = bootLogger.createSubLogger("config");
|
||||
let config;
|
||||
|
||||
try {
|
||||
config = loadConfig();
|
||||
} catch (exception) {
|
||||
if (exception.code === "ENOENT") {
|
||||
configLogger.error("Configuration file not found", null, true);
|
||||
process.exit(1);
|
||||
} else if (e instanceof Error) {
|
||||
configLogger.error(e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
throw exception;
|
||||
}
|
||||
|
||||
configLogger.succ("Loaded");
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
async function connectDb(): Promise<void> {
|
||||
const dbLogger = bootLogger.createSubLogger("db");
|
||||
|
||||
// Try to connect to DB
|
||||
try {
|
||||
dbLogger.info("Connecting...");
|
||||
await initDb();
|
||||
const v = await db
|
||||
.query("SHOW server_version")
|
||||
.then((x) => x[0].server_version);
|
||||
dbLogger.succ(`Connected: v${v}`);
|
||||
} catch (e) {
|
||||
dbLogger.error("Cannot connect", null, true);
|
||||
dbLogger.error(e);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
async function spawnWorkers(limit = 1) {
|
||||
const workers = Math.min(limit, os.cpus().length);
|
||||
bootLogger.info(`Starting ${workers} worker${workers === 1 ? "" : "s"}...`);
|
||||
await Promise.all([...Array(workers)].map(spawnWorker));
|
||||
bootLogger.succ("All workers started");
|
||||
}
|
||||
|
||||
function spawnWorker(): Promise<void> {
|
||||
return new Promise((res) => {
|
||||
const worker = cluster.fork();
|
||||
worker.on("message", (message) => {
|
||||
if (message === "listenFailed") {
|
||||
bootLogger.error("The server Listen failed due to the previous error.");
|
||||
process.exit(1);
|
||||
}
|
||||
if (message !== "ready") return;
|
||||
res();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function spawnShell(address: number | string) {
|
||||
logger.info(`Spawning debug shell on ${address}`);
|
||||
if (typeof address == "string") {
|
||||
try {
|
||||
fs.unlinkSync(address);
|
||||
} catch {}
|
||||
}
|
||||
net
|
||||
.createServer()
|
||||
.unref()
|
||||
.listen(address)
|
||||
.on("connection", (socket) => {
|
||||
const r = repl.start({ input: socket, output: socket });
|
||||
socket.on("close", () => r.close());
|
||||
socket.on("error", () => r.close());
|
||||
r.on("close", () => socket.destroy());
|
||||
if (!envOption.disableClustering) {
|
||||
r.defineCommand("worker", (iid) => {
|
||||
r.close();
|
||||
const id = parseInt(iid.trim());
|
||||
cluster.workers[id].send("debug-shell", socket);
|
||||
});
|
||||
}
|
||||
})
|
||||
.on("error", (error) => logger.error(error));
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import net from "node:net";
|
||||
import repl from "node:repl";
|
||||
import cluster from "node:cluster";
|
||||
import { initDb } from "../db/postgre.js";
|
||||
import config from "@/config/index.js";
|
||||
|
||||
/**
|
||||
* Init worker process
|
||||
*/
|
||||
export async function workerMain() {
|
||||
await initDb();
|
||||
|
||||
if (!config.onlyQueueProcessor) {
|
||||
// start server
|
||||
await import("../server/index.js").then((x) => x.default());
|
||||
}
|
||||
|
||||
// start job queue
|
||||
import("../queue/index.js").then((x) => x.default());
|
||||
|
||||
if (cluster.isWorker) {
|
||||
// Send a 'ready' message to parent process
|
||||
process.send!("ready");
|
||||
cluster.worker.on("message", (message, handle) => {
|
||||
if (message == "debug-shell") spawnWorkerShell(handle);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function spawnWorkerShell(socket: net.Socket) {
|
||||
const r = repl.start({ input: socket, output: socket });
|
||||
r.defineCommand("worker", (iid) => {
|
||||
r.close();
|
||||
const id = parseInt(iid.trim());
|
||||
cluster.workers[id].send("debug-shell", socket);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import load from "./load.js";
|
||||
|
||||
export default load();
|
||||
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* Config loader
|
||||
*/
|
||||
|
||||
import * as fs from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { dirname } from "node:path";
|
||||
import * as yaml from "js-yaml";
|
||||
import type { Source, Mixin } from "./types.js";
|
||||
import path from "node:path";
|
||||
import parseDuration from 'parse-duration'
|
||||
|
||||
export default function load() {
|
||||
const _filename = fileURLToPath(import.meta.url);
|
||||
const _dirname = dirname(_filename);
|
||||
|
||||
const dir = `${_dirname}/../../../..`;
|
||||
const {
|
||||
ICESHRIMP_CONFIG: configFile,
|
||||
ICESHRIMP_SECRETS: secretsFile,
|
||||
ICESHRIMP_MEDIA_DIR: mediaDir,
|
||||
} = process.env;
|
||||
|
||||
const configPath =
|
||||
process.env.NODE_ENV === "test"
|
||||
? `${dir}/.config/test.yml`
|
||||
: configFile ?? `${dir}/.config/default.yml`;
|
||||
|
||||
const meta = JSON.parse(
|
||||
fs.readFileSync(`${_dirname}/../../../../built/meta.json`, "utf-8"),
|
||||
);
|
||||
const clientManifest = JSON.parse(
|
||||
fs.readFileSync(
|
||||
`${_dirname}/../../../../built/_client_dist_/manifest.json`,
|
||||
"utf-8",
|
||||
),
|
||||
);
|
||||
let config = yaml.load(fs.readFileSync(configPath, "utf-8")) as Source;
|
||||
if (secretsFile !== undefined)
|
||||
config = Object.assign(config, yaml.load(fs.readFileSync(secretsFile, "utf-8")) as Source);
|
||||
|
||||
const mixin = {} as Mixin;
|
||||
|
||||
const url = tryCreateUrl(config.url);
|
||||
|
||||
config.url = url.origin;
|
||||
|
||||
config.port = config.port || parseInt(process.env.PORT || "", 10);
|
||||
config.listen = process.env.ICESHRIMP_LISTEN ?? config.listen ?? "0.0.0.0";
|
||||
|
||||
if (config.tls != null) {
|
||||
config.tls = {
|
||||
keyPath:
|
||||
typeof config.tls.keyPath === "string"
|
||||
? path.resolve(dir, config.tls.keyPath)
|
||||
: undefined,
|
||||
certPath:
|
||||
typeof config.tls.certPath === "string"
|
||||
? path.resolve(dir, config.tls.certPath)
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
config.images = {
|
||||
info: '/twemoji/1f440.svg',
|
||||
notFound: '/twemoji/2049.svg',
|
||||
error: '/twemoji/1f480.svg',
|
||||
...config.images,
|
||||
};
|
||||
|
||||
config.htmlCache = {
|
||||
ttlSeconds: parseDuration(config.htmlCache?.ttl ?? '1h', 's')!,
|
||||
prewarm: false,
|
||||
dbFallback: false,
|
||||
...config.htmlCache,
|
||||
}
|
||||
|
||||
if (config.htmlCache.ttlSeconds == null) throw new Error('Failed to parse config.htmlCache.ttl');
|
||||
|
||||
config.wordMuteCache = {
|
||||
ttlSeconds: parseDuration(config.wordMuteCache?.ttl ?? '24h', 's')!,
|
||||
}
|
||||
|
||||
if (config.wordMuteCache.ttlSeconds == null) throw new Error('Failed to parse config.wordMuteCache.ttl');
|
||||
|
||||
config.searchEngine = config.searchEngine ?? 'https://duckduckgo.com/?q=';
|
||||
|
||||
config.metrics = config.metrics ?? {};
|
||||
config.metrics.enable = config.metrics?.enable ?? false;
|
||||
|
||||
if (typeof config.shellAddress === "string") {
|
||||
config.shellAddress = path.isAbsolute(config.shellAddress) ? config.shellAddress : path.resolve(`../../${config.shellAddress}`);
|
||||
}
|
||||
|
||||
mixin.version = meta.version;
|
||||
mixin.host = url.host;
|
||||
mixin.hostname = url.hostname;
|
||||
mixin.domain = config.accountDomain ?? url.host;
|
||||
mixin.scheme = url.protocol.replace(/:$/, "");
|
||||
mixin.wsScheme = mixin.scheme.replace("http", "ws");
|
||||
mixin.wsUrl = `${mixin.wsScheme}://${mixin.host}`;
|
||||
mixin.apiUrl = `${mixin.scheme}://${mixin.host}/api`;
|
||||
mixin.authUrl = `${mixin.scheme}://${mixin.host}/auth`;
|
||||
mixin.driveUrl = `${mixin.scheme}://${mixin.host}/files`;
|
||||
mixin.userAgent = `FrozenFriendsYume/${meta.version} (${config.url})`;
|
||||
mixin.clientEntry = clientManifest["src/init.ts"];
|
||||
mixin.mediaDir = mediaDir ?? `${dir}/files`;
|
||||
|
||||
if (!config.redis.prefix) config.redis.prefix = mixin.hostname;
|
||||
|
||||
return Object.assign(config, mixin);
|
||||
}
|
||||
|
||||
function tryCreateUrl(url: string) {
|
||||
try {
|
||||
return new URL(url);
|
||||
} catch (e) {
|
||||
throw new Error(`url="${url}" is not a valid URL.`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
/**
|
||||
* ユーザーが設定する必要のある情報
|
||||
*/
|
||||
|
||||
export type TypeORMLoggingOptions =
|
||||
| "error"
|
||||
| "slow"
|
||||
| "query"
|
||||
| "schema"
|
||||
| "info"
|
||||
| "log";
|
||||
|
||||
export type TypeORMLoggingConfig = TypeORMLoggingOptions | TypeORMLoggingOptions[] | "all";
|
||||
|
||||
export type Source = {
|
||||
repository_url?: string;
|
||||
feedback_url?: string;
|
||||
url: string;
|
||||
accountDomain?: string;
|
||||
port: number;
|
||||
listen?: string;
|
||||
disableHsts?: boolean;
|
||||
tls?: {
|
||||
keyPath?: string;
|
||||
certPath?: string;
|
||||
};
|
||||
db: {
|
||||
logging?: TypeORMLoggingConfig;
|
||||
host: string;
|
||||
port: number;
|
||||
db: string;
|
||||
user: string;
|
||||
pass: string;
|
||||
disableCache?: boolean;
|
||||
extra?: { [x: string]: string };
|
||||
};
|
||||
redis: {
|
||||
host: string;
|
||||
port: number;
|
||||
family?: number;
|
||||
pass?: string;
|
||||
db?: number;
|
||||
prefix?: string;
|
||||
user?: string;
|
||||
tls?: { [y: string]: string };
|
||||
};
|
||||
|
||||
mediaCleanup?: {
|
||||
cron?: boolean;
|
||||
maxAgeDays?: number;
|
||||
keepAvatars?: boolean;
|
||||
keepHeaders?: boolean;
|
||||
};
|
||||
|
||||
images?: {
|
||||
error?: string;
|
||||
notFound?: string;
|
||||
info?: string;
|
||||
};
|
||||
|
||||
htmlCache?: {
|
||||
ttl?: string;
|
||||
ttlSeconds?: number;
|
||||
prewarm?: boolean;
|
||||
dbFallback?: boolean;
|
||||
}
|
||||
|
||||
wordMuteCache?: {
|
||||
ttl?: string;
|
||||
ttlSeconds?: number;
|
||||
}
|
||||
|
||||
searchEngine?: string;
|
||||
|
||||
proxy?: string;
|
||||
proxySmtp?: string;
|
||||
proxyBypassHosts?: string[];
|
||||
|
||||
allowedPrivateNetworks?: string[];
|
||||
|
||||
maxFileSize?: number;
|
||||
|
||||
accesslog?: string;
|
||||
|
||||
clusterLimit?: number;
|
||||
|
||||
onlyQueueProcessor?: boolean;
|
||||
|
||||
cuid?: {
|
||||
length?: number;
|
||||
fingerprint?: string;
|
||||
};
|
||||
|
||||
outgoingAddressFamily?: "ipv4" | "ipv6" | "dual";
|
||||
|
||||
deliverJobConcurrency?: number;
|
||||
inboxJobConcurrency?: number;
|
||||
deliverJobPerSec?: number;
|
||||
inboxJobPerSec?: number;
|
||||
deliverJobMaxAttempts?: number;
|
||||
inboxJobMaxAttempts?: number;
|
||||
|
||||
syslog: {
|
||||
host: string;
|
||||
port: number;
|
||||
};
|
||||
|
||||
mediaProxy?: string;
|
||||
proxyRemoteFiles?: boolean;
|
||||
|
||||
twa: {
|
||||
nameSpace?: string;
|
||||
packageName?: string;
|
||||
sha256CertFingerprints?: string[];
|
||||
};
|
||||
|
||||
reservedUsernames?: string[];
|
||||
|
||||
shellAddress?: number | string;
|
||||
|
||||
// Managed hosting stuff
|
||||
maxUserSignups?: number;
|
||||
isManagedHosting?: boolean;
|
||||
maxNoteLength?: number;
|
||||
maxCaptionLength?: number;
|
||||
deepl: {
|
||||
managed?: boolean;
|
||||
authKey?: string;
|
||||
isPro?: boolean;
|
||||
};
|
||||
libreTranslate: {
|
||||
managed?: boolean;
|
||||
apiUrl?: string;
|
||||
apiKey?: string;
|
||||
};
|
||||
email: {
|
||||
managed?: boolean;
|
||||
address?: string;
|
||||
host?: string;
|
||||
port?: number;
|
||||
user?: string;
|
||||
pass?: string;
|
||||
useImplicitSslTls?: boolean;
|
||||
};
|
||||
objectStorage: {
|
||||
managed?: boolean;
|
||||
baseUrl?: string;
|
||||
bucket?: string;
|
||||
prefix?: string;
|
||||
endpoint?: string;
|
||||
region?: string;
|
||||
accessKey?: string;
|
||||
secretKey?: string;
|
||||
useSsl?: boolean;
|
||||
connnectOverProxy?: boolean;
|
||||
setPublicReadOnUpload?: boolean;
|
||||
s3ForcePathStyle?: boolean;
|
||||
};
|
||||
summalyProxyUrl?: string;
|
||||
metrics?: {
|
||||
enable?: boolean;
|
||||
token?: string;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Misskeyが自動的に(ユーザーが設定した情報から推論して)設定する情報
|
||||
*/
|
||||
export type Mixin = {
|
||||
version: string;
|
||||
host: string;
|
||||
hostname: string;
|
||||
domain: string;
|
||||
scheme: string;
|
||||
wsScheme: string;
|
||||
apiUrl: string;
|
||||
wsUrl: string;
|
||||
authUrl: string;
|
||||
driveUrl: string;
|
||||
userAgent: string;
|
||||
clientEntry: string;
|
||||
mediaDir: string;
|
||||
};
|
||||
|
||||
export type Config = Source & Mixin;
|
||||
@@ -0,0 +1,79 @@
|
||||
import config from "@/config/index.js";
|
||||
import {
|
||||
DB_MAX_NOTE_TEXT_LENGTH,
|
||||
DB_MAX_IMAGE_COMMENT_LENGTH,
|
||||
} from "@/misc/hard-limits.js";
|
||||
|
||||
export const MAX_NOTE_TEXT_LENGTH = Math.min(
|
||||
config.maxNoteLength ?? 3000,
|
||||
DB_MAX_NOTE_TEXT_LENGTH,
|
||||
);
|
||||
export const MAX_CAPTION_TEXT_LENGTH = Math.min(
|
||||
config.maxCaptionLength ?? 1500,
|
||||
DB_MAX_IMAGE_COMMENT_LENGTH,
|
||||
);
|
||||
|
||||
export const SECOND = 1000;
|
||||
export const SEC = 1000; // why do we need this duplicate here?
|
||||
export const MINUTE = 60 * SEC;
|
||||
export const MIN = 60 * SEC; // why do we need this duplicate here?
|
||||
export const HOUR = 60 * MIN;
|
||||
export const DAY = 24 * HOUR;
|
||||
|
||||
export const USER_ONLINE_THRESHOLD = 10 * MINUTE;
|
||||
export const USER_ACTIVE_THRESHOLD = 3 * DAY;
|
||||
|
||||
// List of file types allowed to be viewed directly in the browser
|
||||
// Anything not included here will be responded as application/octet-stream
|
||||
// SVG is not allowed because it generates XSS <- we need to fix this and later allow it to be viewed directly
|
||||
export const FILE_TYPE_BROWSERSAFE = [
|
||||
// Images
|
||||
"image/png",
|
||||
"image/gif", // TODO: deprecated, but still used by old notes, new gifs should be converted to webp in the future
|
||||
"image/jpeg",
|
||||
"image/webp", // TODO: make this the default image format
|
||||
"image/apng",
|
||||
"image/bmp",
|
||||
"image/tiff",
|
||||
"image/x-icon",
|
||||
"image/avif", // not as good supported now, but its good to introduce initial support for the future
|
||||
|
||||
// OggS
|
||||
"audio/opus",
|
||||
"video/ogg",
|
||||
"audio/ogg",
|
||||
"application/ogg",
|
||||
|
||||
// ISO/IEC base media file format
|
||||
"video/quicktime",
|
||||
"video/mp4", // TODO: we need to check for av1 later
|
||||
"video/vnd.avi", // also av1
|
||||
"audio/mp4",
|
||||
"video/x-m4v",
|
||||
"audio/x-m4a",
|
||||
"video/3gpp",
|
||||
"video/3gpp2",
|
||||
"video/3gp2",
|
||||
"audio/3gpp",
|
||||
"audio/3gpp2",
|
||||
"audio/3gp2",
|
||||
|
||||
"video/mpeg",
|
||||
"audio/mpeg",
|
||||
|
||||
"video/webm",
|
||||
"audio/webm",
|
||||
|
||||
"audio/aac",
|
||||
"audio/x-flac",
|
||||
"audio/flac",
|
||||
"audio/vnd.wave",
|
||||
|
||||
// Documents
|
||||
"application/epub+zip",
|
||||
];
|
||||
/*
|
||||
https://github.com/sindresorhus/file-type/blob/main/supported.js
|
||||
https://github.com/sindresorhus/file-type/blob/main/core.js
|
||||
https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers
|
||||
*/
|
||||
@@ -0,0 +1,20 @@
|
||||
// TODO: 消したい
|
||||
|
||||
const interval = 30 * 60 * 1000;
|
||||
import { AttestationChallenges } from "@/models/index.js";
|
||||
import { LessThan } from "typeorm";
|
||||
|
||||
/**
|
||||
* Clean up database occasionally
|
||||
*/
|
||||
export default function () {
|
||||
async function tick() {
|
||||
await AttestationChallenges.delete({
|
||||
createdAt: LessThan(new Date(new Date().getTime() - 5 * 60 * 1000)),
|
||||
});
|
||||
}
|
||||
|
||||
tick();
|
||||
|
||||
setInterval(tick, interval);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import Xev from "xev";
|
||||
import { deliverQueue, inboxQueue } from "../queue/queues.js";
|
||||
|
||||
const ev = new Xev();
|
||||
|
||||
const interval = 10000;
|
||||
|
||||
/**
|
||||
* Report queue stats regularly
|
||||
*/
|
||||
export default function () {
|
||||
const log = [] as any[];
|
||||
|
||||
ev.on("requestQueueStatsLog", (x) => {
|
||||
ev.emit(`queueStatsLog:${x.id}`, log.slice(0, x.length || 50));
|
||||
});
|
||||
|
||||
let activeDeliverJobs = 0;
|
||||
let activeInboxJobs = 0;
|
||||
|
||||
deliverQueue.on("global:active", () => {
|
||||
activeDeliverJobs++;
|
||||
});
|
||||
|
||||
inboxQueue.on("global:active", () => {
|
||||
activeInboxJobs++;
|
||||
});
|
||||
|
||||
async function tick() {
|
||||
const deliverJobCounts = await deliverQueue.getJobCounts();
|
||||
const inboxJobCounts = await inboxQueue.getJobCounts();
|
||||
|
||||
const stats = {
|
||||
deliver: {
|
||||
activeSincePrevTick: activeDeliverJobs,
|
||||
active: deliverJobCounts.active,
|
||||
waiting: deliverJobCounts.waiting,
|
||||
delayed: deliverJobCounts.delayed,
|
||||
},
|
||||
inbox: {
|
||||
activeSincePrevTick: activeInboxJobs,
|
||||
active: inboxJobCounts.active,
|
||||
waiting: inboxJobCounts.waiting,
|
||||
delayed: inboxJobCounts.delayed,
|
||||
},
|
||||
};
|
||||
|
||||
ev.emit("queueStats", stats);
|
||||
|
||||
log.unshift(stats);
|
||||
if (log.length > 200) log.pop();
|
||||
|
||||
activeDeliverJobs = 0;
|
||||
activeInboxJobs = 0;
|
||||
}
|
||||
|
||||
tick();
|
||||
|
||||
setInterval(tick, interval);
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
import si from "systeminformation";
|
||||
import Xev from "xev";
|
||||
import * as osUtils from "os-utils";
|
||||
import { fetchMeta } from "@/misc/fetch-meta.js";
|
||||
|
||||
const ev = new Xev();
|
||||
|
||||
const interval = 2000;
|
||||
|
||||
const roundCpu = (num: number) => Math.round(num * 1000) / 1000;
|
||||
const round = (num: number) => Math.round(num * 10) / 10;
|
||||
|
||||
/**
|
||||
* Report server stats regularly
|
||||
*/
|
||||
export default function () {
|
||||
const log = [] as any[];
|
||||
|
||||
ev.on("requestServerStatsLog", (x) => {
|
||||
ev.emit(`serverStatsLog:${x.id}`, log.slice(0, x.length || 50));
|
||||
});
|
||||
|
||||
fetchMeta().then((meta) => {
|
||||
if (!meta.enableServerMachineStats) return;
|
||||
});
|
||||
|
||||
async function tick() {
|
||||
const cpu = await cpuUsage();
|
||||
const memStats = await mem();
|
||||
const netStats = await net();
|
||||
const fsStats = await fs();
|
||||
|
||||
const stats = {
|
||||
cpu: roundCpu(cpu),
|
||||
mem: {
|
||||
used: round(memStats.used - memStats.buffers - memStats.cached),
|
||||
active: round(memStats.active),
|
||||
total: round(memStats.total),
|
||||
},
|
||||
net: {
|
||||
rx: round(Math.max(0, netStats.rx_sec)),
|
||||
tx: round(Math.max(0, netStats.tx_sec)),
|
||||
},
|
||||
fs: {
|
||||
r: round(Math.max(0, fsStats.rIO_sec ?? 0)),
|
||||
w: round(Math.max(0, fsStats.wIO_sec ?? 0)),
|
||||
}
|
||||
};
|
||||
ev.emit("serverStats", stats);
|
||||
log.unshift(stats);
|
||||
if (log.length > 200) log.pop();
|
||||
}
|
||||
|
||||
tick();
|
||||
|
||||
setInterval(tick, interval);
|
||||
}
|
||||
|
||||
// CPU STAT
|
||||
function cpuUsage(): Promise<number> {
|
||||
return new Promise((res, rej) => {
|
||||
osUtils.cpuUsage((cpuUsage) => {
|
||||
res(cpuUsage);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// MEMORY STAT
|
||||
async function mem() {
|
||||
const data = await si.mem();
|
||||
return data;
|
||||
}
|
||||
|
||||
// NETWORK STAT
|
||||
async function net() {
|
||||
const iface = await si.networkInterfaceDefault();
|
||||
const data = await si.networkStats(iface);
|
||||
return data[0];
|
||||
}
|
||||
|
||||
// FS STAT
|
||||
async function fs() {
|
||||
const data = await si.disksIO().catch(() => ({ rIO_sec: 0, wIO_sec: 0 }));
|
||||
return data || { rIO_sec: 0, wIO_sec: 0 };
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import Logger from "@/services/logger.js";
|
||||
|
||||
export const dbLogger = new Logger("db");
|
||||
@@ -0,0 +1,308 @@
|
||||
// https://github.com/typeorm/typeorm/issues/2400
|
||||
import pg from "pg";
|
||||
pg.types.setTypeParser(20, Number);
|
||||
|
||||
import type { Logger } from "typeorm";
|
||||
import { DataSource } from "typeorm";
|
||||
import * as highlight from "cli-highlight";
|
||||
import config from "@/config/index.js";
|
||||
|
||||
import { User } from "@/models/entities/user.js";
|
||||
import { DriveFile } from "@/models/entities/drive-file.js";
|
||||
import { DriveFolder } from "@/models/entities/drive-folder.js";
|
||||
import { AccessToken } from "@/models/entities/access-token.js";
|
||||
import { App } from "@/models/entities/app.js";
|
||||
import { PollVote } from "@/models/entities/poll-vote.js";
|
||||
import { Note } from "@/models/entities/note.js";
|
||||
import { NoteReaction } from "@/models/entities/note-reaction.js";
|
||||
import { NoteWatching } from "@/models/entities/note-watching.js";
|
||||
import { NoteThreadMuting } from "@/models/entities/note-thread-muting.js";
|
||||
import { NoteUnread } from "@/models/entities/note-unread.js";
|
||||
import { Notification } from "@/models/entities/notification.js";
|
||||
import { Meta } from "@/models/entities/meta.js";
|
||||
import { Following } from "@/models/entities/following.js";
|
||||
import { Instance } from "@/models/entities/instance.js";
|
||||
import { Muting } from "@/models/entities/muting.js";
|
||||
import { RenoteMuting } from "@/models/entities/renote-muting.js";
|
||||
import { SwSubscription } from "@/models/entities/sw-subscription.js";
|
||||
import { Blocking } from "@/models/entities/blocking.js";
|
||||
import { CallBlocking } from "@/models/entities/call-blocking.js";
|
||||
import { UserList } from "@/models/entities/user-list.js";
|
||||
import { UserListJoining } from "@/models/entities/user-list-joining.js";
|
||||
import { UserGroup } from "@/models/entities/user-group.js";
|
||||
import { UserGroupJoining } from "@/models/entities/user-group-joining.js";
|
||||
import { UserGroupInvitation } from "@/models/entities/user-group-invitation.js";
|
||||
import { Hashtag } from "@/models/entities/hashtag.js";
|
||||
import { NoteFavorite } from "@/models/entities/note-favorite.js";
|
||||
import { AbuseUserReport } from "@/models/entities/abuse-user-report.js";
|
||||
import { RegistrationTicket } from "@/models/entities/registration-tickets.js";
|
||||
import { MessagingMessage } from "@/models/entities/messaging-message.js";
|
||||
import { Signin } from "@/models/entities/signin.js";
|
||||
import { AuthSession } from "@/models/entities/auth-session.js";
|
||||
import { FollowRequest } from "@/models/entities/follow-request.js";
|
||||
import { Emoji } from "@/models/entities/emoji.js";
|
||||
import { UserNotePining } from "@/models/entities/user-note-pining.js";
|
||||
import { Poll } from "@/models/entities/poll.js";
|
||||
import { UserKeypair } from "@/models/entities/user-keypair.js";
|
||||
import { UserPublickey } from "@/models/entities/user-publickey.js";
|
||||
import { UserProfile } from "@/models/entities/user-profile.js";
|
||||
import { UserSecurityKey } from "@/models/entities/user-security-key.js";
|
||||
import { AttestationChallenge } from "@/models/entities/attestation-challenge.js";
|
||||
import { Page } from "@/models/entities/page.js";
|
||||
import { PageLike } from "@/models/entities/page-like.js";
|
||||
import { GalleryPost } from "@/models/entities/gallery-post.js";
|
||||
import { GalleryLike } from "@/models/entities/gallery-like.js";
|
||||
import { ModerationLog } from "@/models/entities/moderation-log.js";
|
||||
import { UsedUsername } from "@/models/entities/used-username.js";
|
||||
import { Announcement } from "@/models/entities/announcement.js";
|
||||
import { AnnouncementRead } from "@/models/entities/announcement-read.js";
|
||||
import { Clip } from "@/models/entities/clip.js";
|
||||
import { ClipNote } from "@/models/entities/clip-note.js";
|
||||
import { Antenna } from "@/models/entities/antenna.js";
|
||||
import { PromoNote } from "@/models/entities/promo-note.js";
|
||||
import { PromoRead } from "@/models/entities/promo-read.js";
|
||||
import { Relay } from "@/models/entities/relay.js";
|
||||
import { Channel } from "@/models/entities/channel.js";
|
||||
import { ChannelFollowing } from "@/models/entities/channel-following.js";
|
||||
import { ChannelNotePining } from "@/models/entities/channel-note-pining.js";
|
||||
import { RegistryItem } from "@/models/entities/registry-item.js";
|
||||
import { PasswordResetRequest } from "@/models/entities/password-reset-request.js";
|
||||
import { UserPending } from "@/models/entities/user-pending.js";
|
||||
import { Webhook } from "@/models/entities/webhook.js";
|
||||
import { UserIp } from "@/models/entities/user-ip.js";
|
||||
import { UserEmoji } from "@/models/entities/user-emoji.js";
|
||||
import { NoteEdit } from "@/models/entities/note-edit.js";
|
||||
import { entities as charts } from "@/services/chart/entities.js";
|
||||
import { dbLogger } from "./logger.js";
|
||||
import { OAuthApp } from "@/models/entities/oauth-app.js";
|
||||
import { OAuthToken } from "@/models/entities/oauth-token.js";
|
||||
import { HtmlNoteCacheEntry } from "@/models/entities/html-note-cache-entry.js";
|
||||
import { HtmlUserCacheEntry } from "@/models/entities/html-user-cache-entry.js";
|
||||
import { TypeORMLoggingOptions } from "@/config/types.js";
|
||||
import { Bite } from "@/models/entities/bite.js";
|
||||
import { InteractionStamp } from "@/models/entities/interaction-stamp.js";
|
||||
import { ReversiGame } from "@/models/entities/reversi-game.js";
|
||||
import { ReversiMatching } from "@/models/entities/reversi-matching.js";
|
||||
import { ShogiGame } from "@/models/entities/shogi-game.js";
|
||||
import { ScheduledNote } from "@/models/entities/scheduled-note.js";
|
||||
import { Memoriet } from "@/models/entities/memoriet.js";
|
||||
import { MemorietArchive } from "@/models/entities/memoriet-archive.js";
|
||||
import { MemorietView } from "@/models/entities/memoriet-view.js";
|
||||
import { VerifiedBadgeRequest } from "@/models/entities/verified-badge-request.js";
|
||||
import { Plan } from "@/models/entities/plan.js";
|
||||
import { UserPlan } from "@/models/entities/user-plan.js";
|
||||
|
||||
const sqlLogger = dbLogger.createSubLogger("sql", "gray", false);
|
||||
const isLogEnabled = (level: TypeORMLoggingOptions): boolean => {
|
||||
const logLevel = config.db.logging;
|
||||
return Array.isArray(logLevel)
|
||||
? logLevel.includes(level)
|
||||
: logLevel === level || logLevel?.trim()?.toLowerCase() === "all";
|
||||
};
|
||||
const isLoggingEnabled = () => {
|
||||
const logLevel = config.db.logging;
|
||||
return Array.isArray(logLevel)
|
||||
? logLevel.length > 0
|
||||
: logLevel != null;
|
||||
}
|
||||
|
||||
class MyCustomLogger implements Logger {
|
||||
private highlight(sql: string) {
|
||||
return highlight.highlight(sql, {
|
||||
language: "sql",
|
||||
ignoreIllegals: true,
|
||||
});
|
||||
}
|
||||
|
||||
public logQuery(query: string, parameters?: any[]) {
|
||||
if (isLogEnabled("query"))
|
||||
sqlLogger.info(this.highlight(query).substring(0, 100));
|
||||
}
|
||||
|
||||
public logQueryError(error: string, query: string, parameters?: any[]) {
|
||||
if (isLogEnabled("error")) sqlLogger.error(this.highlight(query));
|
||||
}
|
||||
|
||||
public logQuerySlow(time: number, query: string, parameters?: any[]) {
|
||||
if (isLogEnabled("slow")) sqlLogger.warn(this.highlight(query));
|
||||
}
|
||||
|
||||
public logSchemaBuild(message: string) {
|
||||
if (isLogEnabled("schema")) sqlLogger.info(message);
|
||||
}
|
||||
|
||||
public log(message: string) {
|
||||
if (isLogEnabled("log")) sqlLogger.info(message);
|
||||
}
|
||||
|
||||
public logMigration(message: string) {
|
||||
if (isLogEnabled("info")) sqlLogger.info(message);
|
||||
}
|
||||
}
|
||||
|
||||
export const entities = [
|
||||
Announcement,
|
||||
AnnouncementRead,
|
||||
Meta,
|
||||
Instance,
|
||||
App,
|
||||
AuthSession,
|
||||
AccessToken,
|
||||
User,
|
||||
UserProfile,
|
||||
UserKeypair,
|
||||
UserPublickey,
|
||||
UserList,
|
||||
UserListJoining,
|
||||
UserGroup,
|
||||
UserGroupJoining,
|
||||
UserGroupInvitation,
|
||||
UserNotePining,
|
||||
UserSecurityKey,
|
||||
UsedUsername,
|
||||
AttestationChallenge,
|
||||
Following,
|
||||
FollowRequest,
|
||||
Muting,
|
||||
RenoteMuting,
|
||||
Blocking,
|
||||
CallBlocking,
|
||||
Note,
|
||||
NoteEdit,
|
||||
NoteFavorite,
|
||||
NoteReaction,
|
||||
NoteWatching,
|
||||
NoteThreadMuting,
|
||||
NoteUnread,
|
||||
Page,
|
||||
PageLike,
|
||||
GalleryPost,
|
||||
GalleryLike,
|
||||
DriveFile,
|
||||
DriveFolder,
|
||||
Poll,
|
||||
PollVote,
|
||||
Notification,
|
||||
Emoji,
|
||||
Hashtag,
|
||||
SwSubscription,
|
||||
AbuseUserReport,
|
||||
RegistrationTicket,
|
||||
MessagingMessage,
|
||||
Signin,
|
||||
ModerationLog,
|
||||
Clip,
|
||||
ClipNote,
|
||||
Antenna,
|
||||
PromoNote,
|
||||
PromoRead,
|
||||
Relay,
|
||||
Channel,
|
||||
ChannelFollowing,
|
||||
ChannelNotePining,
|
||||
RegistryItem,
|
||||
PasswordResetRequest,
|
||||
UserPending,
|
||||
Webhook,
|
||||
UserIp,
|
||||
UserEmoji,
|
||||
OAuthApp,
|
||||
OAuthToken,
|
||||
HtmlNoteCacheEntry,
|
||||
HtmlUserCacheEntry,
|
||||
Bite,
|
||||
InteractionStamp,
|
||||
ReversiGame,
|
||||
ReversiMatching,
|
||||
ShogiGame,
|
||||
ScheduledNote,
|
||||
Memoriet,
|
||||
MemorietArchive,
|
||||
MemorietView,
|
||||
VerifiedBadgeRequest,
|
||||
Plan,
|
||||
UserPlan,
|
||||
...charts,
|
||||
];
|
||||
|
||||
const log = isLoggingEnabled() || process.env.LOG_SQL === "true";
|
||||
|
||||
export const db = new DataSource({
|
||||
type: "postgres",
|
||||
host: config.db.host,
|
||||
port: config.db.port,
|
||||
username: config.db.user,
|
||||
password: config.db.pass,
|
||||
database: config.db.db,
|
||||
extra: {
|
||||
statement_timeout: 1000 * 10,
|
||||
...config.db.extra,
|
||||
},
|
||||
synchronize: process.env.NODE_ENV === "test",
|
||||
dropSchema: process.env.NODE_ENV === "test",
|
||||
cache: !config.db.disableCache
|
||||
? {
|
||||
type: "ioredis",
|
||||
options: {
|
||||
host: config.redis.host,
|
||||
port: config.redis.port,
|
||||
family: config.redis.family == null ? 0 : config.redis.family,
|
||||
username: config.redis.user ?? "default",
|
||||
password: config.redis.pass,
|
||||
keyPrefix: `${config.redis.prefix}:query:`,
|
||||
db: config.redis.db || 0,
|
||||
tls: config.redis.tls,
|
||||
},
|
||||
}
|
||||
: false,
|
||||
logging: log,
|
||||
logger: new MyCustomLogger(),
|
||||
maxQueryExecutionTime: 300,
|
||||
entities: entities,
|
||||
migrations: ["../../migration/*.js"],
|
||||
});
|
||||
|
||||
export async function initDb(force = false) {
|
||||
if (force) {
|
||||
if (db.isInitialized) {
|
||||
await db.destroy();
|
||||
}
|
||||
await db.initialize();
|
||||
return;
|
||||
}
|
||||
|
||||
if (db.isInitialized) {
|
||||
// nop
|
||||
} else {
|
||||
await db.initialize();
|
||||
}
|
||||
}
|
||||
|
||||
export async function resetDb() {
|
||||
const reset = async () => {
|
||||
const { redisClient } = await import("./redis.js");
|
||||
await redisClient.flushdb();
|
||||
const tables = await db.query(`SELECT relname AS "table"
|
||||
FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
|
||||
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
|
||||
AND C.relkind = 'r'
|
||||
AND nspname !~ '^pg_toast';`);
|
||||
for (const table of tables) {
|
||||
await db.query(`DELETE FROM "${table.table}" CASCADE`);
|
||||
}
|
||||
};
|
||||
|
||||
for (let i = 1; i <= 3; i++) {
|
||||
try {
|
||||
await reset();
|
||||
} catch (e) {
|
||||
if (i === 3) {
|
||||
throw e;
|
||||
} else {
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import Redis from "ioredis";
|
||||
import config from "@/config/index.js";
|
||||
|
||||
export function createConnection() {
|
||||
let source = config.redis;
|
||||
|
||||
return new Redis({
|
||||
port: source.port,
|
||||
host: source.host,
|
||||
family: source.family ?? 0,
|
||||
password: source.pass,
|
||||
username: source.user ?? "default",
|
||||
keyPrefix: `${source.prefix}:`,
|
||||
db: source.db || 0,
|
||||
tls: source.tls,
|
||||
});
|
||||
}
|
||||
|
||||
export const subscriber = createConnection();
|
||||
subscriber.subscribe(config.redis.prefix ?? config.host);
|
||||
|
||||
export const redisClient = createConnection();
|
||||
@@ -0,0 +1,25 @@
|
||||
const envOption = {
|
||||
onlyQueue: false,
|
||||
onlyServer: false,
|
||||
noDaemons: false,
|
||||
disableClustering: false,
|
||||
verbose: false,
|
||||
withLogTime: false,
|
||||
quiet: false,
|
||||
slow: false,
|
||||
};
|
||||
|
||||
for (const key of Object.keys(envOption) as (keyof typeof envOption)[]) {
|
||||
if (
|
||||
process.env[
|
||||
`MK_${key.replace(/[A-Z]/g, (letter) => `_${letter}`).toUpperCase()}`
|
||||
]
|
||||
)
|
||||
envOption[key] = true;
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === "test") envOption.disableClustering = true;
|
||||
if (process.env.NODE_ENV === "test") envOption.quiet = true;
|
||||
if (process.env.NODE_ENV === "test") envOption.noDaemons = true;
|
||||
|
||||
export { envOption };
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// rome-ignore lint/suspicious/noExplicitAny: i have no idea
|
||||
type FIXME = any;
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Misskey Entry Point!
|
||||
*/
|
||||
|
||||
import { EventEmitter } from "node:events";
|
||||
|
||||
Error.stackTraceLimit = Infinity;
|
||||
EventEmitter.defaultMaxListeners = 128;
|
||||
|
||||
const emitWarning = process.emitWarning;
|
||||
process.emitWarning = ((warning: string | Error, ...args: any[]) => {
|
||||
const code =
|
||||
(warning instanceof Error ? (warning as Error & { code?: string }).code : undefined) ??
|
||||
(typeof args[0] === "object" ? args[0]?.code : undefined) ??
|
||||
(typeof args[1] === "string" ? args[1] : undefined);
|
||||
if (code === "DEP0040" || code === "DEP0060") return;
|
||||
return emitWarning.call(process, warning as any, ...args);
|
||||
}) as typeof process.emitWarning;
|
||||
|
||||
const { default: boot } = await import("./boot/index.js");
|
||||
|
||||
boot().catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
@@ -0,0 +1,141 @@
|
||||
import Router from "@koa/router";
|
||||
import {
|
||||
collectDefaultMetrics,
|
||||
register,
|
||||
Gauge,
|
||||
Counter,
|
||||
CounterConfiguration,
|
||||
} from "prom-client";
|
||||
import config from "./config/index.js";
|
||||
import { queues } from "./queue/queues.js";
|
||||
import cluster from "node:cluster";
|
||||
import Xev from "xev";
|
||||
|
||||
const xev = new Xev();
|
||||
|
||||
if (config.metrics?.enable) {
|
||||
if (cluster.isPrimary) {
|
||||
collectDefaultMetrics();
|
||||
|
||||
new Gauge({
|
||||
name: "iceshrimp_queue_jobs",
|
||||
help: "Amount of jobs in the bull queues",
|
||||
labelNames: ["queue", "status"] as const,
|
||||
async collect() {
|
||||
for (const queue of queues) {
|
||||
const counts = await queue.getJobCounts();
|
||||
this.set({ queue: queue.name, status: "completed" }, counts.completed);
|
||||
this.set({ queue: queue.name, status: "waiting" }, counts.waiting);
|
||||
this.set({ queue: queue.name, status: "active" }, counts.active);
|
||||
this.set({ queue: queue.name, status: "delayed" }, counts.delayed);
|
||||
this.set({ queue: queue.name, status: "failed" }, counts.failed);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (cluster.isPrimary) {
|
||||
xev.on("registry-request", async () => {
|
||||
try {
|
||||
const metrics = await register.metrics();
|
||||
xev.emit("registry-response", {
|
||||
contentType: register.contentType,
|
||||
body: metrics
|
||||
});
|
||||
} catch (error) {
|
||||
xev.emit("registry-response", { error });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export const handleMetrics: Router.Middleware = async (ctx) => {
|
||||
if (config.metrics?.token !== undefined) {
|
||||
if (ctx.query.token === undefined) {
|
||||
ctx.res.statusCode = 401;
|
||||
ctx.body = "Missing token parameter";
|
||||
return;
|
||||
}
|
||||
const correct = config.metrics.token === ctx.query.token;
|
||||
if (!correct) {
|
||||
ctx.res.statusCode = 403;
|
||||
ctx.body = "Incorrect token";
|
||||
return;
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (cluster.isPrimary) {
|
||||
ctx.set("content-type", register.contentType);
|
||||
ctx.body = await register.metrics();
|
||||
} else {
|
||||
const wait = new Promise<void>((resolve, reject) => {
|
||||
const timeout = setTimeout(
|
||||
() => reject("Timeout while waiting for cluster master"),
|
||||
1000 * 60
|
||||
);
|
||||
xev.once("registry-response", (response) => {
|
||||
clearTimeout(timeout);
|
||||
if (response.error) reject(response.error);
|
||||
ctx.set("content-type", response.contentType);
|
||||
ctx.body = response.body;
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
xev.emit("registry-request");
|
||||
await wait;
|
||||
}
|
||||
} catch (err) {
|
||||
ctx.res.statusCode = 500;
|
||||
ctx.body = err;
|
||||
}
|
||||
};
|
||||
|
||||
const counter = (configuration: CounterConfiguration<string>) => {
|
||||
if (config.metrics?.enable) {
|
||||
if (cluster.isPrimary) {
|
||||
const counter = new Counter(configuration);
|
||||
counter.reset(); // initialize internal hashmap
|
||||
xev.on(`metrics-counter-${configuration.name}`, () => counter.inc());
|
||||
return () => counter.inc();
|
||||
} else {
|
||||
return () => xev.emit(`metrics-counter-${configuration.name}`);
|
||||
}
|
||||
} else {
|
||||
return () => { };
|
||||
}
|
||||
};
|
||||
|
||||
export const tickOutbox = counter({
|
||||
name: "iceshrimp_outbox_total",
|
||||
help: "Total AP outbox calls",
|
||||
});
|
||||
|
||||
export const tickInbox = counter({
|
||||
name: "iceshrimp_inbox_total",
|
||||
help: "Total AP inbox calls",
|
||||
});
|
||||
|
||||
export const tickFetch = counter({
|
||||
name: "iceshrimp_fetch_total",
|
||||
help: "Total AP fetch calls",
|
||||
});
|
||||
|
||||
export const tickResolve = counter({
|
||||
name: "iceshrimp_resolve_total",
|
||||
help: "Total AP resolve calls",
|
||||
});
|
||||
|
||||
export const tickBiteIncoming = counter({
|
||||
name: "iceshrimp_bite_remote_incoming_total",
|
||||
help: "Total bites received from remote",
|
||||
});
|
||||
|
||||
export const tickBiteOutgoing = counter({
|
||||
name: "iceshrimp_bite_remote_outgoing_total",
|
||||
help: "Total bites sent to remote",
|
||||
});
|
||||
|
||||
export const tickBiteLocal = counter ({
|
||||
name: "iceshrimp_bite_local_total",
|
||||
help: "Total local bites"
|
||||
});
|
||||
@@ -0,0 +1,221 @@
|
||||
import * as parse5 from "parse5";
|
||||
import { defaultTreeAdapter as treeAdapter } from "parse5";
|
||||
import { getSubjectHostFromUriAndUsernameCached } from "@/remote/resolve-user.js";
|
||||
import type {
|
||||
Node as TreeAdapterNode,
|
||||
ChildNode as TreeAdapterChildNode,
|
||||
} from "parse5/dist/tree-adapters/default.js";
|
||||
|
||||
const urlRegex = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+/;
|
||||
const urlRegexFull = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+$/;
|
||||
|
||||
export async function fromHtml(html: string, hashtagNames?: string[]): Promise<string> {
|
||||
// some AP servers like Pixelfed use br tags as well as newlines
|
||||
html = html.replace(/<br\s?\/?>\r?\n/gi, "\n");
|
||||
|
||||
const dom = parse5.parseFragment(html);
|
||||
|
||||
let text = "";
|
||||
|
||||
for (const n of dom.childNodes) {
|
||||
await analyze(n);
|
||||
}
|
||||
|
||||
return text.trim();
|
||||
|
||||
function getText(node: TreeAdapterNode): string {
|
||||
if (treeAdapter.isTextNode(node)) return node.value;
|
||||
if (!treeAdapter.isElementNode(node)) return "";
|
||||
if (node.nodeName === "br") return "\n";
|
||||
|
||||
if (node.childNodes) {
|
||||
return node.childNodes.map((n) => getText(n)).join("");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
async function appendChildren(childNodes: TreeAdapterChildNode[]): Promise<void> {
|
||||
if (childNodes) {
|
||||
for (const n of childNodes) {
|
||||
await analyze(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function analyze(node: TreeAdapterNode) {
|
||||
if (treeAdapter.isTextNode(node)) {
|
||||
text += node.value;
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip comment or document type node
|
||||
if (!treeAdapter.isElementNode(node)) return;
|
||||
|
||||
// Strip quote marker
|
||||
const classes = node.attrs.find((x) => x.name === "class");
|
||||
if (classes && classes.value.split(" ").includes("quote-inline")) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (node.nodeName) {
|
||||
case "br": {
|
||||
text += "\n";
|
||||
break;
|
||||
}
|
||||
|
||||
case "a": {
|
||||
const txt = getText(node);
|
||||
const rel = node.attrs.find((x) => x.name === "rel");
|
||||
const href = node.attrs.find((x) => x.name === "href");
|
||||
|
||||
// ハッシュタグ
|
||||
if (
|
||||
hashtagNames &&
|
||||
href &&
|
||||
hashtagNames.map((x) => x.toLowerCase()).includes(txt.toLowerCase())
|
||||
) {
|
||||
text += txt;
|
||||
// メンション
|
||||
} else if (txt.startsWith("@") && !rel?.value.match(/^me /)) {
|
||||
const part = txt.split("@");
|
||||
|
||||
if (part.length === 2 && href) {
|
||||
//#region ホスト名部分が省略されているので復元する
|
||||
const acct = `${txt}@${await getSubjectHostFromUriAndUsernameCached(href.value, txt)}`;
|
||||
text += acct;
|
||||
//#endregion
|
||||
} else if (part.length === 3) {
|
||||
text += txt;
|
||||
}
|
||||
// その他
|
||||
} else {
|
||||
const generateLink = () => {
|
||||
if (!(href || txt)) {
|
||||
return "";
|
||||
}
|
||||
if (!href) {
|
||||
return txt;
|
||||
}
|
||||
if (!txt || txt === href.value) {
|
||||
// #6383: Missing text node
|
||||
if (href.value.match(urlRegexFull)) {
|
||||
return href.value;
|
||||
} else {
|
||||
return `<${href.value}>`;
|
||||
}
|
||||
}
|
||||
if (href.value.match(urlRegex) && !href.value.match(urlRegexFull)) {
|
||||
return `[${txt}](<${href.value}>)`; // #6846
|
||||
} else {
|
||||
return `[${txt}](${href.value})`;
|
||||
}
|
||||
};
|
||||
|
||||
text += generateLink();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "h1": {
|
||||
text += "【";
|
||||
await appendChildren(node.childNodes);
|
||||
text += "】\n";
|
||||
break;
|
||||
}
|
||||
|
||||
case "b":
|
||||
case "strong": {
|
||||
text += "**";
|
||||
await appendChildren(node.childNodes);
|
||||
text += "**";
|
||||
break;
|
||||
}
|
||||
|
||||
case "small": {
|
||||
text += "<small>";
|
||||
await appendChildren(node.childNodes);
|
||||
text += "</small>";
|
||||
break;
|
||||
}
|
||||
|
||||
case "s":
|
||||
case "del": {
|
||||
text += "~~";
|
||||
await appendChildren(node.childNodes);
|
||||
text += "~~";
|
||||
break;
|
||||
}
|
||||
|
||||
case "i":
|
||||
case "em": {
|
||||
text += "<i>";
|
||||
await appendChildren(node.childNodes);
|
||||
text += "</i>";
|
||||
break;
|
||||
}
|
||||
|
||||
// block code (<pre><code>)
|
||||
case "pre": {
|
||||
if (
|
||||
node.childNodes.length === 1 &&
|
||||
node.childNodes[0].nodeName === "code"
|
||||
) {
|
||||
text += "\n```\n";
|
||||
text += getText(node.childNodes[0]);
|
||||
text += "\n```\n";
|
||||
} else {
|
||||
await appendChildren(node.childNodes);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// inline code (<code>)
|
||||
case "code": {
|
||||
text += "`";
|
||||
await appendChildren(node.childNodes);
|
||||
text += "`";
|
||||
break;
|
||||
}
|
||||
|
||||
case "blockquote": {
|
||||
const t = getText(node);
|
||||
if (t) {
|
||||
text += "\n> ";
|
||||
text += t.split("\n").join("\n> ");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "p":
|
||||
case "h2":
|
||||
case "h3":
|
||||
case "h4":
|
||||
case "h5":
|
||||
case "h6": {
|
||||
text += "\n\n";
|
||||
await appendChildren(node.childNodes);
|
||||
break;
|
||||
}
|
||||
|
||||
// other block elements
|
||||
case "div":
|
||||
case "header":
|
||||
case "footer":
|
||||
case "article":
|
||||
case "li":
|
||||
case "dt":
|
||||
case "dd": {
|
||||
text += "\n";
|
||||
await appendChildren(node.childNodes);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
// includes inline elements
|
||||
await appendChildren(node.childNodes);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
import { Window as HappyDom } from "happy-dom";
|
||||
import type * as mfm from "mfm-js";
|
||||
import config from "@/config/index.js";
|
||||
import { intersperse } from "@/prelude/array.js";
|
||||
import type { IMentionedRemoteUsers } from "@/models/entities/note.js";
|
||||
import { resolveMentionFromCache } from "@/remote/resolve-user.js";
|
||||
|
||||
export async function toHtml(
|
||||
nodes: mfm.MfmNode[] | null,
|
||||
mentionedRemoteUsers: IMentionedRemoteUsers = [],
|
||||
objectHost: string | null
|
||||
) {
|
||||
if (nodes == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const window = new HappyDom();
|
||||
|
||||
const doc = window.document;
|
||||
|
||||
function appendTextWithGlyphs(text: string, targetElement: Element): void {
|
||||
const regexp = /;([^:;\s]{1,100});/g;
|
||||
let last = 0;
|
||||
|
||||
for (const match of text.matchAll(regexp)) {
|
||||
if (match.index! > last) {
|
||||
targetElement.appendChild(doc.createTextNode(text.slice(last, match.index)));
|
||||
}
|
||||
|
||||
targetElement.appendChild(doc.createTextNode(`\u200B:${match[1]}:\u200B`));
|
||||
last = match.index! + match[0].length;
|
||||
}
|
||||
|
||||
if (last < text.length) {
|
||||
targetElement.appendChild(doc.createTextNode(text.slice(last)));
|
||||
}
|
||||
}
|
||||
|
||||
async function appendChildren(children: mfm.MfmNode[], targetElement: any): Promise<void> {
|
||||
if (children) {
|
||||
for (const child of await Promise.all(children.map(async (x) => await (handlers as any)[x.type](x))))
|
||||
targetElement.appendChild(child);
|
||||
}
|
||||
}
|
||||
|
||||
const handlers: {
|
||||
[K in mfm.MfmNode["type"]]: (node: mfm.NodeType<K>) => any;
|
||||
} = {
|
||||
async bold(node) {
|
||||
const el = doc.createElement("b");
|
||||
await appendChildren(node.children, el);
|
||||
return el;
|
||||
},
|
||||
|
||||
async small(node) {
|
||||
const el = doc.createElement("small");
|
||||
await appendChildren(node.children, el);
|
||||
return el;
|
||||
},
|
||||
|
||||
async strike(node) {
|
||||
const el = doc.createElement("del");
|
||||
await appendChildren(node.children, el);
|
||||
return el;
|
||||
},
|
||||
|
||||
async italic(node) {
|
||||
const el = doc.createElement("i");
|
||||
await appendChildren(node.children, el);
|
||||
return el;
|
||||
},
|
||||
|
||||
async fn(node) {
|
||||
const el = doc.createElement("i");
|
||||
await appendChildren(node.children, el);
|
||||
return el;
|
||||
},
|
||||
|
||||
blockCode(node) {
|
||||
const pre = doc.createElement("pre");
|
||||
const inner = doc.createElement("code");
|
||||
inner.textContent = node.props.code;
|
||||
pre.appendChild(inner);
|
||||
return pre;
|
||||
},
|
||||
|
||||
async center(node) {
|
||||
const el = doc.createElement("div");
|
||||
await appendChildren(node.children, el);
|
||||
return el;
|
||||
},
|
||||
|
||||
emojiCode(node) {
|
||||
return doc.createTextNode(`\u200B:${node.props.name}:\u200B`);
|
||||
},
|
||||
|
||||
unicodeEmoji(node) {
|
||||
return doc.createTextNode(node.props.emoji);
|
||||
},
|
||||
|
||||
hashtag(node) {
|
||||
const a = doc.createElement("a");
|
||||
a.setAttribute('href', `${config.url}/tags/${node.props.hashtag}`);
|
||||
a.textContent = `#${node.props.hashtag}`;
|
||||
a.setAttribute("rel", "tag");
|
||||
return a;
|
||||
},
|
||||
|
||||
inlineCode(node) {
|
||||
const el = doc.createElement("code");
|
||||
el.textContent = node.props.code;
|
||||
return el;
|
||||
},
|
||||
|
||||
mathInline(node) {
|
||||
const el = doc.createElement("code");
|
||||
el.textContent = node.props.formula;
|
||||
return el;
|
||||
},
|
||||
|
||||
mathBlock(node) {
|
||||
const el = doc.createElement("code");
|
||||
el.textContent = node.props.formula;
|
||||
return el;
|
||||
},
|
||||
|
||||
async link(node) {
|
||||
const a = doc.createElement("a");
|
||||
a.setAttribute('href', node.props.url);
|
||||
await appendChildren(node.children, a);
|
||||
return a;
|
||||
},
|
||||
|
||||
async mention(node) {
|
||||
const { username, host, acct } = node.props;
|
||||
const resolved = await resolveMentionFromCache(username, host, objectHost, mentionedRemoteUsers);
|
||||
|
||||
const el = doc.createElement("span");
|
||||
if (resolved === null) {
|
||||
el.textContent = acct;
|
||||
} else {
|
||||
el.setAttribute("class", "h-card");
|
||||
el.setAttribute("translate", "no");
|
||||
const a = doc.createElement("a");
|
||||
a.setAttribute('href', resolved.href);
|
||||
a.className = "u-url mention";
|
||||
const span = doc.createElement("span");
|
||||
span.textContent = resolved.username;
|
||||
a.textContent = '@';
|
||||
a.appendChild(span);
|
||||
el.appendChild(a);
|
||||
}
|
||||
|
||||
return el;
|
||||
},
|
||||
|
||||
async quote(node) {
|
||||
const el = doc.createElement("blockquote");
|
||||
await appendChildren(node.children, el);
|
||||
return el;
|
||||
},
|
||||
|
||||
text(node) {
|
||||
const el = doc.createElement("span");
|
||||
const lines = node.props.text.split(/\r\n|\r|\n/);
|
||||
|
||||
for (const x of intersperse<FIXME | string>("br", lines)) {
|
||||
if (x === "br") {
|
||||
el.appendChild(doc.createElement("br"));
|
||||
continue;
|
||||
}
|
||||
|
||||
appendTextWithGlyphs(x, el);
|
||||
}
|
||||
|
||||
return el;
|
||||
},
|
||||
|
||||
url(node) {
|
||||
const a = doc.createElement("a");
|
||||
a.setAttribute('href', node.props.url);
|
||||
a.textContent = node.props.url.replace(/^https?:\/\//, '');
|
||||
return a;
|
||||
},
|
||||
|
||||
search(node) {
|
||||
const a = doc.createElement("a");
|
||||
a.setAttribute('href', `${config.searchEngine}${node.props.query}`);
|
||||
a.textContent = node.props.content;
|
||||
return a;
|
||||
},
|
||||
|
||||
async plain(node) {
|
||||
const el = doc.createElement("span");
|
||||
await appendChildren(node.children, el);
|
||||
return el;
|
||||
},
|
||||
};
|
||||
|
||||
await appendChildren(nodes, doc.body);
|
||||
|
||||
const html = `<p>${doc.body.innerHTML}</p>`;
|
||||
await window.happyDOM.close();
|
||||
return html;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class Pages1556348509290 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "page_visibility_enum" AS ENUM('public', 'followers', 'specified')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "page" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "title" character varying(256) NOT NULL, "name" character varying(256) NOT NULL, "summary" character varying(256), "alignCenter" boolean NOT NULL, "font" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "eyeCatchingImageId" character varying(32), "content" jsonb NOT NULL DEFAULT '[]', "variables" jsonb NOT NULL DEFAULT '[]', "visibility" "page_visibility_enum" NOT NULL, "visibleUserIds" character varying(32) array NOT NULL DEFAULT '{}'::varchar[], CONSTRAINT "PK_742f4117e065c5b6ad21b37ba1f" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_fbb4297c927a9b85e9cefa2eb1" ON "page" ("createdAt") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_af639b066dfbca78b01a920f8a" ON "page" ("updatedAt") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_b82c19c08afb292de4600d99e4" ON "page" ("name") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_ae1d917992dd0c9d9bbdad06c4" ON "page" ("userId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_90148bbc2bf0854428786bfc15" ON "page" ("visibleUserIds") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_2133ef8317e4bdb839c0dcbf13" ON "page" ("userId", "name") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page" ADD CONSTRAINT "FK_ae1d917992dd0c9d9bbdad06c4a" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page" ADD CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10" FOREIGN KEY ("eyeCatchingImageId") REFERENCES "drive_file"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page" DROP CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page" DROP CONSTRAINT "FK_ae1d917992dd0c9d9bbdad06c4a"`,
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_2133ef8317e4bdb839c0dcbf13"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_90148bbc2bf0854428786bfc15"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_ae1d917992dd0c9d9bbdad06c4"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_b82c19c08afb292de4600d99e4"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_af639b066dfbca78b01a920f8a"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_fbb4297c927a9b85e9cefa2eb1"`);
|
||||
await queryRunner.query(`DROP TABLE "page"`);
|
||||
await queryRunner.query(`DROP TYPE "page_visibility_enum"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class UserProfile1556746559567 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ALTER COLUMN "githubId" TYPE VARCHAR(64) USING "githubId"::VARCHAR(64)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ALTER COLUMN "discordExpiresDate" TYPE VARCHAR(64) USING "discordExpiresDate"::VARCHAR(64)`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`UPDATE "user_profile" SET github = FALSE, discord = FALSE`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ALTER COLUMN "githubId" TYPE INTEGER USING NULL`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ALTER COLUMN "discordExpiresDate" TYPE INTEGER USING NULL`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class PinnedUsers1557476068003 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "pinnedUsers" character varying(256) array NOT NULL DEFAULT '{}'::varchar[]`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedUsers"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class AddSomeUrls1557761316509 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "ToSUrl" character varying(512)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "repositoryUrl" character varying(512) NOT NULL DEFAULT 'https://codeberg.org/firefish/firefish'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "feedbackUrl" character varying(512) DEFAULT 'https://codeberg.org/firefish/firefish/issues'`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "feedbackUrl"`);
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "repositoryUrl"`);
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "ToSUrl"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class ObjectStorageSetting1557932705754 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "useObjectStorage" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "objectStorageBucket" character varying(512)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "objectStoragePrefix" character varying(512)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "objectStorageBaseUrl" character varying(512)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "objectStorageEndpoint" character varying(512)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "objectStorageRegion" character varying(512)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "objectStorageAccessKey" character varying(512)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "objectStorageSecretKey" character varying(512)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "objectStoragePort" integer`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "objectStorageUseSSL" boolean NOT NULL DEFAULT true`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "objectStorageUseSSL"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "objectStoragePort"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "objectStorageSecretKey"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "objectStorageAccessKey"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "objectStorageRegion"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "objectStorageEndpoint"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "objectStorageBaseUrl"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "objectStoragePrefix"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "objectStorageBucket"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "useObjectStorage"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class PageLike1558072954435 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "page_like" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "pageId" character varying(32) NOT NULL, CONSTRAINT "PK_813f034843af992d3ae0f43c64c" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_0e61efab7f88dbb79c9166dbb4" ON "page_like" ("userId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_4ce6fb9c70529b4c8ac46c9bfa" ON "page_like" ("userId", "pageId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page" ADD "likedCount" integer NOT NULL DEFAULT 0`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page_like" ADD CONSTRAINT "FK_0e61efab7f88dbb79c9166dbb48" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page_like" ADD CONSTRAINT "FK_cf8782626dced3176038176a847" FOREIGN KEY ("pageId") REFERENCES "page"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page_like" DROP CONSTRAINT "FK_cf8782626dced3176038176a847"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page_like" DROP CONSTRAINT "FK_0e61efab7f88dbb79c9166dbb48"`,
|
||||
);
|
||||
await queryRunner.query(`ALTER TABLE "page" DROP COLUMN "likedCount"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_4ce6fb9c70529b4c8ac46c9bfa"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_0e61efab7f88dbb79c9166dbb4"`);
|
||||
await queryRunner.query(`DROP TABLE "page_like"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class UserGroup1558103093633 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "user_group" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "name" character varying(256) NOT NULL, "userId" character varying(32) NOT NULL, "isPrivate" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_3c29fba6fe013ec8724378ce7c9" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_20e30aa35180e317e133d75316" ON "user_group" ("createdAt") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_3d6b372788ab01be58853003c9" ON "user_group" ("userId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "user_group_joining" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "userGroupId" character varying(32) NOT NULL, CONSTRAINT "PK_15f2425885253c5507e1599cfe7" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f3a1b4bd0c7cabba958a0c0b23" ON "user_group_joining" ("userId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_67dc758bc0566985d1b3d39986" ON "user_group_joining" ("userGroupId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "messaging_message" ADD "groupId" character varying(32)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "messaging_message" ADD "reads" character varying(32) array NOT NULL DEFAULT '{}'::varchar[]`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "messaging_message" ALTER COLUMN "recipientId" DROP NOT NULL`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`COMMENT ON COLUMN "messaging_message"."recipientId" IS 'The recipient user ID.'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_2c4be03b446884f9e9c502135b" ON "messaging_message" ("groupId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "messaging_message" ADD CONSTRAINT "FK_2c4be03b446884f9e9c502135be" FOREIGN KEY ("groupId") REFERENCES "user_group"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group" ADD CONSTRAINT "FK_3d6b372788ab01be58853003c93" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group_joining" ADD CONSTRAINT "FK_f3a1b4bd0c7cabba958a0c0b231" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group_joining" ADD CONSTRAINT "FK_67dc758bc0566985d1b3d399865" FOREIGN KEY ("userGroupId") REFERENCES "user_group"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group_joining" DROP CONSTRAINT "FK_67dc758bc0566985d1b3d399865"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group_joining" DROP CONSTRAINT "FK_f3a1b4bd0c7cabba958a0c0b231"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group" DROP CONSTRAINT "FK_3d6b372788ab01be58853003c93"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "messaging_message" DROP CONSTRAINT "FK_2c4be03b446884f9e9c502135be"`,
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_2c4be03b446884f9e9c502135b"`);
|
||||
await queryRunner.query(
|
||||
`COMMENT ON COLUMN "messaging_message"."recipientId" IS ''`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "messaging_message" ALTER COLUMN "recipientId" SET NOT NULL`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "messaging_message" DROP COLUMN "reads"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "messaging_message" DROP COLUMN "groupId"`,
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_67dc758bc0566985d1b3d39986"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f3a1b4bd0c7cabba958a0c0b23"`);
|
||||
await queryRunner.query(`DROP TABLE "user_group_joining"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_3d6b372788ab01be58853003c9"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_20e30aa35180e317e133d75316"`);
|
||||
await queryRunner.query(`DROP TABLE "user_group"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class UserGroupInvite1558257926829 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "user_group_invite" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "userGroupId" character varying(32) NOT NULL, CONSTRAINT "PK_3893884af0d3a5f4d01e7921a97" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_1039988afa3bf991185b277fe0" ON "user_group_invite" ("userId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e10924607d058004304611a436" ON "user_group_invite" ("userGroupId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_78787741f9010886796f2320a4" ON "user_group_invite" ("userId", "userGroupId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_d9ecaed8c6dc43f3592c229282" ON "user_group_joining" ("userId", "userGroupId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group_invite" ADD CONSTRAINT "FK_1039988afa3bf991185b277fe03" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group_invite" ADD CONSTRAINT "FK_e10924607d058004304611a436a" FOREIGN KEY ("userGroupId") REFERENCES "user_group"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group_invite" DROP CONSTRAINT "FK_e10924607d058004304611a436a"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group_invite" DROP CONSTRAINT "FK_1039988afa3bf991185b277fe03"`,
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_d9ecaed8c6dc43f3592c229282"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_78787741f9010886796f2320a4"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_e10924607d058004304611a436"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_1039988afa3bf991185b277fe0"`);
|
||||
await queryRunner.query(`DROP TABLE "user_group_invite"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class UserListJoining1558266512381 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_90f7da835e4c10aca6853621e1" ON "user_list_joining" ("userId", "userListId") `,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_90f7da835e4c10aca6853621e1"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class webauthn1561706992953 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "attestation_challenge" ("id" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "challenge" character varying(64) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "registrationChallenge" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_d0ba6786e093f1bcb497572a6b5" PRIMARY KEY ("id", "userId"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f1a461a618fa1755692d0e0d59" ON "attestation_challenge" ("userId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_47efb914aed1f72dd39a306c7b" ON "attestation_challenge" ("challenge") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "user_security_key" ("id" character varying NOT NULL, "userId" character varying(32) NOT NULL, "publicKey" character varying NOT NULL, "lastUsed" TIMESTAMP WITH TIME ZONE NOT NULL, "name" character varying(30) NOT NULL, CONSTRAINT "PK_3e508571121ab39c5f85d10c166" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_ff9ca3b5f3ee3d0681367a9b44" ON "user_security_key" ("userId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_0d7718e562dcedd0aa5cf2c9f7" ON "user_security_key" ("publicKey") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "securityKeysAvailable" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "attestation_challenge" ADD CONSTRAINT "FK_f1a461a618fa1755692d0e0d592" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_security_key" ADD CONSTRAINT "FK_ff9ca3b5f3ee3d0681367a9b447" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_security_key" DROP CONSTRAINT "FK_ff9ca3b5f3ee3d0681367a9b447"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "attestation_challenge" DROP CONSTRAINT "FK_f1a461a618fa1755692d0e0d592"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "securityKeysAvailable"`,
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_0d7718e562dcedd0aa5cf2c9f7"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_ff9ca3b5f3ee3d0681367a9b44"`);
|
||||
await queryRunner.query(`DROP TABLE "user_security_key"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_47efb914aed1f72dd39a306c7b"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f1a461a618fa1755692d0e0d59"`);
|
||||
await queryRunner.query(`DROP TABLE "attestation_challenge"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,377 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class ChartIndexes1561873850023 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc" ON "__chart__active_users" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_15e91a03aeeac9dbccdf43fc06" ON "__chart__active_users" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_00ed5f86db1f7efafb1978bf21" ON "__chart__active_users" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_20f57cc8f142c131340ee16742" ON "__chart__active_users" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_9a3ed15a30ab7e3a37702e6e08" ON "__chart__active_users" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_c26e2c1cbb6e911e0554b27416" ON "__chart__active_users" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_13565815f618a1ff53886c5b28" ON "__chart__drive" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_3fa0d0f17ca72e3dc80999a032" ON "__chart__drive" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_7a170f67425e62a8fabb76c872" ON "__chart__drive" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_6e1df243476e20cbf86572ecc0" ON "__chart__drive" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_3313d7288855ec105b5bbf6c21" ON "__chart__drive" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_06690fc959f1c9fdaf21928222" ON "__chart__drive" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_36cb699c49580d4e6c2e6159f9" ON "__chart__federation" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e447064455928cf627590ef527" ON "__chart__federation" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_76e87c7bfc5d925fcbba405d84" ON "__chart__federation" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_2d416e6af791a82e338c79d480" ON "__chart__federation" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_dd907becf76104e4b656659e6b" ON "__chart__federation" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e9cd07672b37d8966cf3709283" ON "__chart__federation" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_07747a1038c05f532a718fe1de" ON "__chart__hashtag" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_fcc181fb8283009c61cc4083ef" ON "__chart__hashtag" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_99a7d2faaef84a6f728d714ad6" ON "__chart__hashtag" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_49975586f50ed7b800fdd88fbd" ON "__chart__hashtag" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_25a97c02003338124b2b75fdbc" ON "__chart__hashtag" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_6d6f156ceefc6bc5f273a0e370" ON "__chart__hashtag" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_6b8f34a1a64b06014b6fb66824" ON "__chart__instance" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_c12f0af4a66cdd30c2287ce8aa" ON "__chart__instance" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_da8a46ba84ca1d8bb5a29bfb63" ON "__chart__instance" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_d0a4f79af5a97b08f37b547197" ON "__chart__instance" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_39ee857ab2f23493037c6b6631" ON "__chart__instance" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f5448d9633cff74208d850aabe" ON "__chart__instance" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_a1efd3e0048a5f2793a47360dc" ON "__chart__network" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f8dd01baeded2ffa833e0a610a" ON "__chart__network" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_7b5da130992ec9df96712d4290" ON "__chart__network" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_08fac0eb3b11f04c200c0b40dd" ON "__chart__network" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_0a905b992fecd2b5c3fb98759e" ON "__chart__network" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_9ff6944f01acb756fdc92d7563" ON "__chart__network" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_42eb716a37d381cdf566192b2b" ON "__chart__notes" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e69096589f11e3baa98ddd64d0" ON "__chart__notes" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_7036f2957151588b813185c794" ON "__chart__notes" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_0c9a159c5082cbeef3ca6706b5" ON "__chart__notes" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f09d543e3acb16c5976bdb31fa" ON "__chart__notes" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_924fc196c80ca24bae01dd37e4" ON "__chart__notes" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_5f86db6492274e07c1a3cdf286" ON "__chart__per_user_drive" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_328f259961e60c4fa0bfcf55ca" ON "__chart__per_user_drive" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e496ca8096d28f6b9b509264dc" ON "__chart__per_user_drive" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_42ea9381f0fda8dfe0fa1c8b53" ON "__chart__per_user_drive" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_30bf67687f483ace115c5ca642" ON "__chart__per_user_drive" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f2aeafde2ae6fbad38e857631b" ON "__chart__per_user_drive" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_7af07790712aa3438ff6773f3b" ON "__chart__per_user_following" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f92dd6d03f8d994f29987f6214" ON "__chart__per_user_following" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_4b3593098b6edc9c5afe36b18b" ON "__chart__per_user_following" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_57b5458d0d3d6d1e7f13d4e57f" ON "__chart__per_user_following" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_b77d4dd9562c3a899d9a286fcd" ON "__chart__per_user_following" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_4db3b84c7be0d3464714f3e0b1" ON "__chart__per_user_following" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_84234bd1abb873f07329681c83" ON "__chart__per_user_notes" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_8d2cbbc8114d90d19b44d626b6" ON "__chart__per_user_notes" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_55bf20f366979f2436de99206b" ON "__chart__per_user_notes" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_046feeb12e9ef5f783f409866a" ON "__chart__per_user_notes" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_5048e9daccbbbc6d567bb142d3" ON "__chart__per_user_notes" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f68a5ab958f9f5fa17a32ac23b" ON "__chart__per_user_notes" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f7bf4c62059764c2c2bb40fdab" ON "__chart__per_user_reaction" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_65633a106bce43fc7c5c30a5c7" ON "__chart__per_user_reaction" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_8cf3156fd7a6b15c43459c6e3b" ON "__chart__per_user_reaction" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_edeb73c09c3143a81bcb34d569" ON "__chart__per_user_reaction" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_229a41ad465f9205f1f5703291" ON "__chart__per_user_reaction" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e316f01a6d24eb31db27f88262" ON "__chart__per_user_reaction" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_0c641990ecf47d2545df4edb75" ON "__chart__test_grouped" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_2be7ec6cebddc14dc11e206686" ON "__chart__test_grouped" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_234dff3c0b56a6150b95431ab9" ON "__chart__test_grouped" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_a5133470f4825902e170328ca5" ON "__chart__test_grouped" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_b14489029e4b3aaf4bba5fb524" ON "__chart__test_grouped" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_84e661abb7bd1e51b690d4b017" ON "__chart__test_grouped" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_437bab3c6061d90f6bb65fd2cc" ON "__chart__test_unique" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_5c73bf61da4f6e6f15bae88ed1" ON "__chart__test_unique" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_bbfa573a8181018851ed0b6357" ON "__chart__test_unique" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_d70c86baedc68326be11f9c0ce" ON "__chart__test_unique" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_a0cd75442dd10d0643a17c4a49" ON "__chart__test_unique" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_66e1e1ecd2f29e57778af35b59" ON "__chart__test_unique" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_b070a906db04b44c67c6c2144d" ON "__chart__test" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_92255988735563f0fe4aba1f05" ON "__chart__test" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_d41cce6aee1a50bfc062038f9b" ON "__chart__test" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_c5870993e25c3d5771f91f5003" ON "__chart__test" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_a319e5dbf47e8a17497623beae" ON "__chart__test" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f170de677ea75ad4533de2723e" ON "__chart__test" ("span", "date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_845254b3eaf708ae8a6cac3026" ON "__chart__users" ("date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_7c184198ecf66a8d3ecb253ab3" ON "__chart__users" ("span") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_ed9b95919c672a13008e9487ee" ON "__chart__users" ("group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f091abb24193d50c653c6b77fc" ON "__chart__users" ("span", "date") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_337e9599f278bd7537fe30876f" ON "__chart__users" ("date", "group") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_a770a57c70e668cc61590c9161" ON "__chart__users" ("span", "date", "group") `,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_a770a57c70e668cc61590c9161"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_337e9599f278bd7537fe30876f"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f091abb24193d50c653c6b77fc"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_ed9b95919c672a13008e9487ee"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_7c184198ecf66a8d3ecb253ab3"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_845254b3eaf708ae8a6cac3026"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f170de677ea75ad4533de2723e"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_a319e5dbf47e8a17497623beae"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_c5870993e25c3d5771f91f5003"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_d41cce6aee1a50bfc062038f9b"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_92255988735563f0fe4aba1f05"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_b070a906db04b44c67c6c2144d"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_66e1e1ecd2f29e57778af35b59"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_a0cd75442dd10d0643a17c4a49"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_d70c86baedc68326be11f9c0ce"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_bbfa573a8181018851ed0b6357"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_5c73bf61da4f6e6f15bae88ed1"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_437bab3c6061d90f6bb65fd2cc"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_84e661abb7bd1e51b690d4b017"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_b14489029e4b3aaf4bba5fb524"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_a5133470f4825902e170328ca5"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_234dff3c0b56a6150b95431ab9"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_2be7ec6cebddc14dc11e206686"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_0c641990ecf47d2545df4edb75"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_e316f01a6d24eb31db27f88262"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_229a41ad465f9205f1f5703291"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_edeb73c09c3143a81bcb34d569"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_8cf3156fd7a6b15c43459c6e3b"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_65633a106bce43fc7c5c30a5c7"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f7bf4c62059764c2c2bb40fdab"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f68a5ab958f9f5fa17a32ac23b"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_5048e9daccbbbc6d567bb142d3"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_046feeb12e9ef5f783f409866a"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_55bf20f366979f2436de99206b"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_8d2cbbc8114d90d19b44d626b6"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_84234bd1abb873f07329681c83"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_4db3b84c7be0d3464714f3e0b1"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_b77d4dd9562c3a899d9a286fcd"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_57b5458d0d3d6d1e7f13d4e57f"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_4b3593098b6edc9c5afe36b18b"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f92dd6d03f8d994f29987f6214"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_7af07790712aa3438ff6773f3b"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f2aeafde2ae6fbad38e857631b"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_30bf67687f483ace115c5ca642"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_42ea9381f0fda8dfe0fa1c8b53"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_e496ca8096d28f6b9b509264dc"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_328f259961e60c4fa0bfcf55ca"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_5f86db6492274e07c1a3cdf286"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_924fc196c80ca24bae01dd37e4"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f09d543e3acb16c5976bdb31fa"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_0c9a159c5082cbeef3ca6706b5"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_7036f2957151588b813185c794"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_e69096589f11e3baa98ddd64d0"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_42eb716a37d381cdf566192b2b"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_9ff6944f01acb756fdc92d7563"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_0a905b992fecd2b5c3fb98759e"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_08fac0eb3b11f04c200c0b40dd"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_7b5da130992ec9df96712d4290"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f8dd01baeded2ffa833e0a610a"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_a1efd3e0048a5f2793a47360dc"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f5448d9633cff74208d850aabe"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_39ee857ab2f23493037c6b6631"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_d0a4f79af5a97b08f37b547197"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_da8a46ba84ca1d8bb5a29bfb63"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_c12f0af4a66cdd30c2287ce8aa"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_6b8f34a1a64b06014b6fb66824"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_6d6f156ceefc6bc5f273a0e370"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_25a97c02003338124b2b75fdbc"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_49975586f50ed7b800fdd88fbd"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_99a7d2faaef84a6f728d714ad6"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_fcc181fb8283009c61cc4083ef"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_07747a1038c05f532a718fe1de"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_e9cd07672b37d8966cf3709283"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_dd907becf76104e4b656659e6b"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_2d416e6af791a82e338c79d480"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_76e87c7bfc5d925fcbba405d84"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_e447064455928cf627590ef527"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_36cb699c49580d4e6c2e6159f9"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_06690fc959f1c9fdaf21928222"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_3313d7288855ec105b5bbf6c21"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_6e1df243476e20cbf86572ecc0"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_7a170f67425e62a8fabb76c872"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_3fa0d0f17ca72e3dc80999a032"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_13565815f618a1ff53886c5b28"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_c26e2c1cbb6e911e0554b27416"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_9a3ed15a30ab7e3a37702e6e08"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_20f57cc8f142c131340ee16742"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_00ed5f86db1f7efafb1978bf21"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_15e91a03aeeac9dbccdf43fc06"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_0ad37b7ef50f4ddc84363d7ccc"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_90148bbc2bf0854428786bfc15"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_88937d94d7443d9a99a76fa5c0"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_54ebcb6d27222913b908d56fd8"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_796a8c03959361f97dc2be1d5c"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_25dfc71b0369b003a4cd434d0b"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_51c063b6a133a9cb87145450f5"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_fa99d777623947a5b05f394cae"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_315c779174fe8247ab324f036e"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_c5d46cbfda48b1c33ed852e21b"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_8cb40cfc8f3c28261e6f887b03"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class PasswordLessLogin1562422242907 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD COLUMN "usePasswordLessLogin" boolean DEFAULT false NOT NULL`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "usePasswordLessLogin"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class PinnedPage1562444565093 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "pinnedPageId" character varying(32)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD CONSTRAINT "UQ_6dc44f1ceb65b1e72bacef2ca27" UNIQUE ("pinnedPageId")`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD CONSTRAINT "FK_6dc44f1ceb65b1e72bacef2ca27" FOREIGN KEY ("pinnedPageId") REFERENCES "page"("id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP CONSTRAINT "FK_6dc44f1ceb65b1e72bacef2ca27"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP CONSTRAINT "UQ_6dc44f1ceb65b1e72bacef2ca27"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "pinnedPageId"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class PageTitleHideOption1562448332510 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page" ADD "hideTitleWhenPinned" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page" DROP COLUMN "hideTitleWhenPinned"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class ModerationLog1562869971568 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "moderation_log" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "type" character varying(128) NOT NULL, "info" jsonb NOT NULL, CONSTRAINT "PK_d0adca6ecfd068db83e4526cc26" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_a08ad074601d204e0f69da9a95" ON "moderation_log" ("userId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "moderation_log" ADD CONSTRAINT "FK_a08ad074601d204e0f69da9a954" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "moderation_log" DROP CONSTRAINT "FK_a08ad074601d204e0f69da9a954"`,
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_a08ad074601d204e0f69da9a95"`);
|
||||
await queryRunner.query(`DROP TABLE "moderation_log"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class UsedUsername1563757595828 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "used_username" ("username" character varying(128) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, CONSTRAINT "PK_78fd79d2d24c6ac2f4cc9a31a5d" PRIMARY KEY ("username"))`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP TABLE "used_username"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class room1565634203341 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "room" jsonb NOT NULL DEFAULT '{}'`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "room"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class CustomEmojiCategory1571220798684 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "emoji" ADD "category" character varying(128)`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "emoji" DROP COLUMN "category"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class nodeinfo1572760203493 implements MigrationInterface {
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" DROP COLUMN "system"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "softwareName" character varying(64) DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "softwareVersion" character varying(64) DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "openRegistrations" boolean DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "name" character varying(256) DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "description" character varying(4096) DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "maintainerName" character varying(128) DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "maintainerEmail" character varying(256) DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "infoUpdatedAt" TIMESTAMP WITH TIME ZONE`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" DROP COLUMN "infoUpdatedAt"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" DROP COLUMN "maintainerEmail"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" DROP COLUMN "maintainerName"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" DROP COLUMN "description"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" DROP COLUMN "name"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" DROP COLUMN "openRegistrations"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" DROP COLUMN "softwareVersion"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" DROP COLUMN "softwareName"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "system" character varying(64)`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class TalkFederationId1576269851876 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "TalkFederationId1576269851876";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "messaging_message" ADD "uri" character varying(512)`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "messaging_message" DROP COLUMN "uri"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class ProxyRemoteFiles1576869585998 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "ProxyRemoteFiles1576869585998";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "proxyRemoteFiles" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "proxyRemoteFiles"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v121579267006611 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v121579267006611";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "announcement" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "text" character varying(8192) NOT NULL, "title" character varying(256) NOT NULL, "imageUrl" character varying(1024), CONSTRAINT "PK_e0ef0550174fd1099a308fd18a0" PRIMARY KEY ("id"))`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_118ec703e596086fc4515acb39" ON "announcement" ("createdAt") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "announcement_read" ("id" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "announcementId" character varying(32) NOT NULL, CONSTRAINT "PK_4b90ad1f42681d97b2683890c5e" PRIMARY KEY ("id"))`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_8288151386172b8109f7239ab2" ON "announcement_read" ("userId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_603a7b1e7aa0533c6c88e9bfaf" ON "announcement_read" ("announcementId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_924fa71815cfa3941d003702a0" ON "announcement_read" ("userId", "announcementId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user" DROP COLUMN "isVerified"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "announcements"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "enableEmojiReaction"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "announcement_read" ADD CONSTRAINT "FK_8288151386172b8109f7239ab28" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "announcement_read" ADD CONSTRAINT "FK_603a7b1e7aa0533c6c88e9bfafe" FOREIGN KEY ("announcementId") REFERENCES "announcement"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "announcement_read" DROP CONSTRAINT "FK_603a7b1e7aa0533c6c88e9bfafe"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "announcement_read" DROP CONSTRAINT "FK_8288151386172b8109f7239ab28"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "enableEmojiReaction" boolean NOT NULL DEFAULT true`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "announcements" jsonb NOT NULL DEFAULT '[]'`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user" ADD "isVerified" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_924fa71815cfa3941d003702a0"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_603a7b1e7aa0533c6c88e9bfaf"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_8288151386172b8109f7239ab2"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "announcement_read"`, undefined);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_118ec703e596086fc4515acb39"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "announcement"`, undefined);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v1221579270193251 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v1221579270193251";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "announcement_read" ADD "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "announcement_read" DROP COLUMN "createdAt"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v1231579282808087 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v1231579282808087";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "announcement" ADD "updatedAt" TIMESTAMP WITH TIME ZONE`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "announcement" DROP COLUMN "updatedAt"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v1241579544426412 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v1241579544426412";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD "followRequestId" character varying(32)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD CONSTRAINT "FK_bd7fab507621e635b32cd31892c" FOREIGN KEY ("followRequestId") REFERENCES "follow_request"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP CONSTRAINT "FK_bd7fab507621e635b32cd31892c"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP COLUMN "followRequestId"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v1251579977526288 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v1251579977526288";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "clip" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "isPublic" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_f0685dac8d4dd056d7255670b75" PRIMARY KEY ("id"))`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_2b5ec6c574d6802c94c80313fb" ON "clip" ("userId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "clip_note" ("id" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "clipId" character varying(32) NOT NULL, CONSTRAINT "PK_e94cda2f40a99b57e032a1a738b" PRIMARY KEY ("id"))`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_a012eaf5c87c65da1deb5fdbfa" ON "clip_note" ("noteId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_ebe99317bbbe9968a0c6f579ad" ON "clip_note" ("clipId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_6fc0ec357d55a18646262fdfff" ON "clip_note" ("noteId", "clipId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "antenna_src_enum" AS ENUM('home', 'all', 'list')`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "antenna" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "src" "antenna_src_enum" NOT NULL, "userListId" character varying(32), "keywords" jsonb NOT NULL DEFAULT '[]', "withFile" boolean NOT NULL, "expression" character varying(2048), "notify" boolean NOT NULL, "hasNewNote" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_c170b99775e1dccca947c9f2d5f" PRIMARY KEY ("id"))`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_6446c571a0e8d0f05f01c78909" ON "antenna" ("userId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "antenna_note" ("id" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "antennaId" character varying(32) NOT NULL, CONSTRAINT "PK_fb28d94d0989a3872df19fd6ef8" PRIMARY KEY ("id"))`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_bd0397be22147e17210940e125" ON "antenna_note" ("noteId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_0d775946662d2575dfd2068a5f" ON "antenna_note" ("antennaId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_335a0bf3f904406f9ef3dd51c2" ON "antenna_note" ("noteId", "antennaId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "geo"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "clip" ADD CONSTRAINT "FK_2b5ec6c574d6802c94c80313fb2" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "clip_note" ADD CONSTRAINT "FK_a012eaf5c87c65da1deb5fdbfa3" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "clip_note" ADD CONSTRAINT "FK_ebe99317bbbe9968a0c6f579adf" FOREIGN KEY ("clipId") REFERENCES "clip"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ADD CONSTRAINT "FK_6446c571a0e8d0f05f01c789096" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ADD CONSTRAINT "FK_709d7d32053d0dd7620f678eeb9" FOREIGN KEY ("userListId") REFERENCES "user_list"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna_note" ADD CONSTRAINT "FK_bd0397be22147e17210940e125b" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna_note" ADD CONSTRAINT "FK_0d775946662d2575dfd2068a5f5" FOREIGN KEY ("antennaId") REFERENCES "antenna"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna_note" DROP CONSTRAINT "FK_0d775946662d2575dfd2068a5f5"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna_note" DROP CONSTRAINT "FK_bd0397be22147e17210940e125b"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" DROP CONSTRAINT "FK_709d7d32053d0dd7620f678eeb9"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" DROP CONSTRAINT "FK_6446c571a0e8d0f05f01c789096"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "clip_note" DROP CONSTRAINT "FK_ebe99317bbbe9968a0c6f579adf"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "clip_note" DROP CONSTRAINT "FK_a012eaf5c87c65da1deb5fdbfa3"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "clip" DROP CONSTRAINT "FK_2b5ec6c574d6802c94c80313fb2"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`ALTER TABLE "note" ADD "geo" jsonb`, undefined);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_335a0bf3f904406f9ef3dd51c2"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_0d775946662d2575dfd2068a5f"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_bd0397be22147e17210940e125"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "antenna_note"`, undefined);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_6446c571a0e8d0f05f01c78909"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "antenna"`, undefined);
|
||||
await queryRunner.query(`DROP TYPE "antenna_src_enum"`, undefined);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_6fc0ec357d55a18646262fdfff"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_ebe99317bbbe9968a0c6f579ad"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_a012eaf5c87c65da1deb5fdbfa"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "clip_note"`, undefined);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_2b5ec6c574d6802c94c80313fb"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "clip"`, undefined);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v1261579993013959 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v1261579993013959";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" DROP COLUMN "hasNewNote"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna_note" ADD "read" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_9937ea48d7ae97ffb4f3f063a4" ON "antenna_note" ("read") `,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_9937ea48d7ae97ffb4f3f063a4"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna_note" DROP COLUMN "read"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ADD "hasNewNote" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v1271580069531114 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v1271580069531114";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ADD "users" character varying(1024) array NOT NULL DEFAULT '{}'::varchar[]`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ADD "caseSensitive" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "public"."antenna_src_enum" RENAME TO "antenna_src_enum_old"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "antenna_src_enum" AS ENUM('home', 'all', 'users', 'list')`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "antenna_src_enum" USING "src"::"text"::"antenna_src_enum"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TYPE "antenna_src_enum_old"`, undefined);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "antenna_src_enum_old" AS ENUM('home', 'all', 'list')`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "antenna_src_enum_old" USING "src"::"text"::"antenna_src_enum_old"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TYPE "antenna_src_enum"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "antenna_src_enum_old" RENAME TO "antenna_src_enum"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" DROP COLUMN "caseSensitive"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" DROP COLUMN "users"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v1281580148575182 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v1281580148575182";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note" DROP CONSTRAINT "FK_ec5c201576192ba8904c345c5cc"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note" DROP COLUMN "appId"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note" ADD "appId" character varying(32)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note" ADD CONSTRAINT "FK_ec5c201576192ba8904c345c5cc" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v1291580154400017 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v1291580154400017";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ADD "withReplies" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" DROP COLUMN "withReplies"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v12101580276619901 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v12101580276619901";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`TRUNCATE TABLE "notification"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP COLUMN "type"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted')`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD "type" "notification_type_enum" NOT NULL`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP COLUMN "type"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TYPE "notification_type_enum"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD "type" character varying(32) NOT NULL`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v12111580331224276 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v12111580331224276";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" DROP COLUMN "isMarkedAsClosed"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "isSuspended" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_34500da2e38ac393f7bb6b299c" ON "instance" ("isSuspended") `,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_34500da2e38ac393f7bb6b299c"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" DROP COLUMN "isSuspended"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "isMarkedAsClosed" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v12121580508795118 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v12121580508795118";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "twitter"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "twitterAccessToken"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "twitterAccessTokenSecret"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "twitterUserId"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "twitterScreenName"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "github"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "githubAccessToken"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "githubId"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "githubLogin"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "discord"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "discordAccessToken"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "discordRefreshToken"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "discordExpiresDate"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "discordId"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "discordUsername"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "discordDiscriminator"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "integrations" jsonb NOT NULL DEFAULT '{}'`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "integrations"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "discordDiscriminator" character varying(64) DEFAULT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "discordUsername" character varying(64) DEFAULT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "discordId" character varying(64) DEFAULT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "discordExpiresDate" character varying(64)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "discordRefreshToken" character varying(64) DEFAULT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "discordAccessToken" character varying(64) DEFAULT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "discord" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "githubLogin" character varying(64) DEFAULT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "githubId" character varying(64)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "githubAccessToken" character varying(64) DEFAULT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "github" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "twitterScreenName" character varying(64) DEFAULT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "twitterUserId" character varying(64) DEFAULT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "twitterAccessTokenSecret" character varying(64) DEFAULT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "twitterAccessToken" character varying(64) DEFAULT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "twitter" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v12131580543501339 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v12131580543501339";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_NOTE_TAGS" ON "note" USING gin ("tags")`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_NOTE_TAGS"`, undefined);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class v12141580864313253 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "v12141580864313253";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" RENAME COLUMN "proxyAccount" TO "proxyAccountId"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "proxyAccountId"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "proxyAccountId" character varying(32)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD CONSTRAINT "FK_ab1bc0c1e209daa77b8e8d212ad" FOREIGN KEY ("proxyAccountId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP CONSTRAINT "FK_ab1bc0c1e209daa77b8e8d212ad"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "proxyAccountId"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "proxyAccountId" character varying(128)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" RENAME COLUMN "proxyAccountId" TO "proxyAccount"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class userGroupInvitation1581526429287 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "userGroupInvitation1581526429287";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "user_group_invitation" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "userGroupId" character varying(32) NOT NULL, CONSTRAINT "PK_160c63ec02bf23f6a5c5e8140d6" PRIMARY KEY ("id"))`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_bfbc6305547539369fe73eb144" ON "user_group_invitation" ("userId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_5cc8c468090e129857e9fecce5" ON "user_group_invitation" ("userGroupId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_e9793f65f504e5a31fbaedbf2f" ON "user_group_invitation" ("userId", "userGroupId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD "userGroupInvitationId" character varying(32)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "public"."notification_type_enum" RENAME TO "notification_type_enum_old"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited')`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum" USING "type"::"text"::"notification_type_enum"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "notification_type_enum_old"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`COMMENT ON COLUMN "notification"."type" IS 'The type of the Notification.'`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group_invitation" ADD CONSTRAINT "FK_bfbc6305547539369fe73eb144a" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group_invitation" ADD CONSTRAINT "FK_5cc8c468090e129857e9fecce5a" FOREIGN KEY ("userGroupId") REFERENCES "user_group"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD CONSTRAINT "FK_8fe87814e978053a53b1beb7e98" FOREIGN KEY ("userGroupInvitationId") REFERENCES "user_group_invitation"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP CONSTRAINT "FK_8fe87814e978053a53b1beb7e98"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group_invitation" DROP CONSTRAINT "FK_5cc8c468090e129857e9fecce5a"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_group_invitation" DROP CONSTRAINT "FK_bfbc6305547539369fe73eb144a"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`COMMENT ON COLUMN "notification"."type" IS ''`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "notification_type_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted')`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum_old" USING "type"::"text"::"notification_type_enum_old"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TYPE "notification_type_enum"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "notification_type_enum_old" RENAME TO "notification_type_enum"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP COLUMN "userGroupInvitationId"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_e9793f65f504e5a31fbaedbf2f"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_5cc8c468090e129857e9fecce5"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_bfbc6305547539369fe73eb144"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "user_group_invitation"`, undefined);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class userGroupAntenna1581695816408 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "userGroupAntenna1581695816408";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ADD "userGroupJoiningId" character varying(32)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "public"."antenna_src_enum" RENAME TO "antenna_src_enum_old"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "antenna_src_enum" AS ENUM('home', 'all', 'users', 'list', 'group')`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "antenna_src_enum" USING "src"::"text"::"antenna_src_enum"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TYPE "antenna_src_enum_old"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" DROP COLUMN "users"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ADD "users" character varying(1024) array NOT NULL DEFAULT '{}'::varchar[]`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ADD CONSTRAINT "FK_ccbf5a8c0be4511133dcc50ddeb" FOREIGN KEY ("userGroupJoiningId") REFERENCES "user_group_joining"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" DROP CONSTRAINT "FK_ccbf5a8c0be4511133dcc50ddeb"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" DROP COLUMN "users"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ADD "users" character varying array NOT NULL DEFAULT '{}'`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "antenna_src_enum_old" AS ENUM('home', 'all', 'users', 'list')`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ALTER COLUMN "src" TYPE "antenna_src_enum_old" USING "src"::"text"::"antenna_src_enum_old"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TYPE "antenna_src_enum"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "antenna_src_enum_old" RENAME TO "antenna_src_enum"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" DROP COLUMN "userGroupJoiningId"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class driveUserFolderIdIndex1581708415836 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "driveUserFolderIdIndex1581708415836";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_55720b33a61a7c806a8215b825" ON "drive_file" ("userId", "folderId", "id") `,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_55720b33a61a7c806a8215b825"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class promo1581979837262 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "promo1581979837262";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "promo_note" ("noteId" character varying(32) NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, CONSTRAINT "REL_e263909ca4fe5d57f8d4230dd5" UNIQUE ("noteId"), CONSTRAINT "PK_e263909ca4fe5d57f8d4230dd5c" PRIMARY KEY ("noteId"))`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_83f0862e9bae44af52ced7099e" ON "promo_note" ("userId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "promo_read" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, CONSTRAINT "PK_61917c1541002422b703318b7c9" PRIMARY KEY ("id"))`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_9657d55550c3d37bfafaf7d4b0" ON "promo_read" ("userId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_2882b8a1a07c7d281a98b6db16" ON "promo_read" ("userId", "noteId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "promo_note" ADD CONSTRAINT "FK_e263909ca4fe5d57f8d4230dd5c" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "promo_read" ADD CONSTRAINT "FK_9657d55550c3d37bfafaf7d4b05" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "promo_read" ADD CONSTRAINT "FK_a46a1a603ecee695d7db26da5f4" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "promo_read" DROP CONSTRAINT "FK_a46a1a603ecee695d7db26da5f4"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "promo_read" DROP CONSTRAINT "FK_9657d55550c3d37bfafaf7d4b05"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "promo_note" DROP CONSTRAINT "FK_e263909ca4fe5d57f8d4230dd5c"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_2882b8a1a07c7d281a98b6db16"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_9657d55550c3d37bfafaf7d4b0"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "promo_read"`, undefined);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_83f0862e9bae44af52ced7099e"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "promo_note"`, undefined);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class featuredInjecttion1582019042083 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "featuredInjecttion1582019042083";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "injectFeaturedNote" boolean NOT NULL DEFAULT true`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "injectFeaturedNote"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class antennaExclude1582210532752 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "antennaExclude1582210532752";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" ADD "excludeKeywords" jsonb NOT NULL DEFAULT '[]'`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "antenna" DROP COLUMN "excludeKeywords"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class noteReactionLength1582875306439 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "noteReactionLength1582875306439";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(130)`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(128)`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class miauth1585361548360 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "miauth1585361548360";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ADD "lastUsedAt" TIMESTAMP WITH TIME ZONE DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ADD "session" character varying(128) DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ADD "name" character varying(128) DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ADD "description" character varying(512) DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ADD "iconUrl" character varying(512) DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ADD "permission" character varying(64) array NOT NULL DEFAULT '{}'::varchar[]`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ADD "fetched" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" DROP CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ALTER COLUMN "appId" DROP NOT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ALTER COLUMN "appId" SET DEFAULT null`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_bf3a053c07d9fb5d87317c56ee" ON "access_token" ("session") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ADD CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" DROP CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_bf3a053c07d9fb5d87317c56ee"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ALTER COLUMN "appId" DROP DEFAULT`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ALTER COLUMN "appId" SET NOT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" ADD CONSTRAINT "FK_a3ff16c90cc87a82a0b5959e560" FOREIGN KEY ("appId") REFERENCES "app"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" DROP COLUMN "fetched"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" DROP COLUMN "permission"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" DROP COLUMN "iconUrl"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" DROP COLUMN "description"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" DROP COLUMN "name"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" DROP COLUMN "session"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "access_token" DROP COLUMN "lastUsedAt"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class customNotification1585385921215 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "customNotification1585385921215";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD "customBody" character varying(2048)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD "customHeader" character varying(256)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD "customIcon" character varying(1024)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD "appAccessTokenId" character varying(32)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ALTER COLUMN "notifierId" DROP NOT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`COMMENT ON COLUMN "notification"."notifierId" IS 'The ID of sender user of the Notification.'`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "public"."notification_type_enum" RENAME TO "notification_type_enum_old"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "notification_type_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum" USING "type"::"text"::"notification_type_enum"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "notification_type_enum_old"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`COMMENT ON COLUMN "notification"."type" IS 'The type of the Notification.'`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_3b4e96eec8d36a8bbb9d02aa71" ON "notification" ("notifierId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_33f33cc8ef29d805a97ff4628b" ON "notification" ("type") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_080ab397c379af09b9d2169e5b" ON "notification" ("isRead") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_e22bf6bda77b6adc1fd9e75c8c" ON "notification" ("appAccessTokenId") `,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710" FOREIGN KEY ("notifierId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD CONSTRAINT "FK_e22bf6bda77b6adc1fd9e75c8c9" FOREIGN KEY ("appAccessTokenId") REFERENCES "access_token"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP CONSTRAINT "FK_e22bf6bda77b6adc1fd9e75c8c9"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_e22bf6bda77b6adc1fd9e75c8c"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_080ab397c379af09b9d2169e5b"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_33f33cc8ef29d805a97ff4628b"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_3b4e96eec8d36a8bbb9d02aa71"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`COMMENT ON COLUMN "notification"."type" IS ''`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "notification_type_enum_old" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited')`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ALTER COLUMN "type" TYPE "notification_type_enum_old" USING "type"::"text"::"notification_type_enum_old"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TYPE "notification_type_enum"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "notification_type_enum_old" RENAME TO "notification_type_enum"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`COMMENT ON COLUMN "notification"."notifierId" IS ''`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ALTER COLUMN "notifierId" SET NOT NULL`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" ADD CONSTRAINT "FK_3b4e96eec8d36a8bbb9d02aa710" FOREIGN KEY ("notifierId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP COLUMN "appAccessTokenId"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP COLUMN "customIcon"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP COLUMN "customHeader"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "notification" DROP COLUMN "customBody"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class apUrl1585772678853 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "apUrl1585772678853";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note" ADD "url" character varying(512)`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "url"`, undefined);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class AddObjectStorageUseProxy1586624197029 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "AddObjectStorageUseProxy1586624197029";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "objectStorageUseProxy" boolean NOT NULL DEFAULT true`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "objectStorageUseProxy"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class remoteReaction1586641139527 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "remoteReaction1586641139527";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(260)`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note_reaction" ALTER COLUMN "reaction" TYPE character varying(130)`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class pageAiScript1586708940386 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "pageAiScript1586708940386";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page" ADD "script" character varying(16384) NOT NULL DEFAULT ''`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "page" DROP COLUMN "script"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class hCaptcha1588044505511 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "hCaptcha1588044505511";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "enableHcaptcha" boolean NOT NULL DEFAULT false`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "hcaptchaSiteKey" character varying(64)`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "hcaptchaSecretKey" character varying(64)`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "hcaptchaSecretKey"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "hcaptchaSiteKey"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "enableHcaptcha"`,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class pubRelay1589023282116 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "pubRelay1589023282116";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "relay_status_enum" AS ENUM('requesting', 'accepted', 'rejected')`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "relay" ("id" character varying(32) NOT NULL, "inbox" character varying(512) NOT NULL, "status" "relay_status_enum" NOT NULL, CONSTRAINT "PK_78ebc9cfddf4292633b7ba57aee" PRIMARY KEY ("id"))`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_0d9a1738f2cf7f3b1c3334dfab" ON "relay" ("inbox") `,
|
||||
undefined,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`DROP INDEX "IDX_0d9a1738f2cf7f3b1c3334dfab"`,
|
||||
undefined,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "relay"`, undefined);
|
||||
await queryRunner.query(`DROP TYPE "relay_status_enum"`, undefined);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class blurhash1595075960584 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "blurhash1595075960584";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "drive_file" ADD "blurhash" character varying(128)`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "drive_file" DROP COLUMN "blurhash"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class blurhashForAvatarBanner1595077605646 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "blurhashForAvatarBanner1595077605646";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "avatarColor"`);
|
||||
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "bannerColor"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user" ADD "avatarBlurhash" character varying(128)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user" ADD "bannerBlurhash" character varying(128)`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "bannerBlurhash"`);
|
||||
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "avatarBlurhash"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user" ADD "bannerColor" character varying(32)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user" ADD "avatarColor" character varying(32)`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class instanceIconUrl1595676934834 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "instanceIconUrl1595676934834";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "iconUrl" character varying(256) DEFAULT null`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "iconUrl"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class wordMute1595771249699 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "wordMute1595771249699";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "muted_note" ("id" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, CONSTRAINT "PK_897e2eff1c0b9b64e55ca1418a4" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_70ab9786313d78e4201d81cdb8" ON "muted_note" ("noteId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_d8e07aa18c2d64e86201601aec" ON "muted_note" ("userId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_a8c6bfd637d3f1d67a27c48e27" ON "muted_note" ("noteId", "userId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "enableWordMute" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "mutedWords" jsonb NOT NULL DEFAULT '[]'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_3befe6f999c86aff06eb0257b4" ON "user_profile" ("enableWordMute") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "muted_note" ADD CONSTRAINT "FK_70ab9786313d78e4201d81cdb89" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "muted_note" ADD CONSTRAINT "FK_d8e07aa18c2d64e86201601aec1" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "muted_note" DROP CONSTRAINT "FK_d8e07aa18c2d64e86201601aec1"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "muted_note" DROP CONSTRAINT "FK_70ab9786313d78e4201d81cdb89"`,
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_3befe6f999c86aff06eb0257b4"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "mutedWords"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "enableWordMute"`,
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_a8c6bfd637d3f1d67a27c48e27"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_d8e07aa18c2d64e86201601aec"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_70ab9786313d78e4201d81cdb8"`);
|
||||
await queryRunner.query(`DROP TABLE "muted_note"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class wordMute21595782306083 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "wordMute21595782306083";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "muted_note_reason_enum" AS ENUM('word', 'manual', 'spam', 'other')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "muted_note" ADD "reason" "muted_note_reason_enum" NOT NULL`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_636e977ff90b23676fb5624b25" ON "muted_note" ("reason") `,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_636e977ff90b23676fb5624b25"`);
|
||||
await queryRunner.query(`ALTER TABLE "muted_note" DROP COLUMN "reason"`);
|
||||
await queryRunner.query(`DROP TYPE "muted_note_reason_enum"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class channel1596548170836 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "channel1596548170836";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "channel" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "lastNotedAt" TIMESTAMP WITH TIME ZONE, "userId" character varying(32) NOT NULL, "name" character varying(128) NOT NULL, "description" character varying(2048), "bannerId" character varying(32), "notesCount" integer NOT NULL DEFAULT 0, "usersCount" integer NOT NULL DEFAULT 0, CONSTRAINT "PK_590f33ee6ee7d76437acf362e39" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_71cb7b435b7c0d4843317e7e16" ON "channel" ("createdAt") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_29ef80c6f13bcea998447fce43" ON "channel" ("lastNotedAt") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_823bae55bd81b3be6e05cff438" ON "channel" ("userId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_0f58c11241e649d2a638a8de94" ON "channel" ("notesCount") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_094b86cd36bb805d1aa1e8cc9a" ON "channel" ("usersCount") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "channel_following" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "followeeId" character varying(32) NOT NULL, "followerId" character varying(32) NOT NULL, CONSTRAINT "PK_8b104be7f7415113f2a02cd5bdd" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_11e71f2511589dcc8a4d3214f9" ON "channel_following" ("createdAt") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_0e43068c3f92cab197c3d3cd86" ON "channel_following" ("followeeId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_6d8084ec9496e7334a4602707e" ON "channel_following" ("followerId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_2e230dd45a10e671d781d99f3e" ON "channel_following" ("followerId", "followeeId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "channel_note_pining" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "channelId" character varying(32) NOT NULL, "noteId" character varying(32) NOT NULL, CONSTRAINT "PK_44f7474496bcf2e4b741681146d" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_8125f950afd3093acb10d2db8a" ON "channel_note_pining" ("channelId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_f36fed37d6d4cdcc68c803cd9c" ON "channel_note_pining" ("channelId", "noteId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note" ADD "channelId" character varying(32) DEFAULT null`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f22169eb10657bded6d875ac8f" ON "note" ("channelId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel" ADD CONSTRAINT "FK_823bae55bd81b3be6e05cff4383" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel" ADD CONSTRAINT "FK_999da2bcc7efadbfe0e92d3bc19" FOREIGN KEY ("bannerId") REFERENCES "drive_file"("id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note" ADD CONSTRAINT "FK_f22169eb10657bded6d875ac8f9" FOREIGN KEY ("channelId") REFERENCES "channel"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel_following" ADD CONSTRAINT "FK_0e43068c3f92cab197c3d3cd86e" FOREIGN KEY ("followeeId") REFERENCES "channel"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel_following" ADD CONSTRAINT "FK_6d8084ec9496e7334a4602707e1" FOREIGN KEY ("followerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel_note_pining" ADD CONSTRAINT "FK_8125f950afd3093acb10d2db8a8" FOREIGN KEY ("channelId") REFERENCES "channel"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel_note_pining" ADD CONSTRAINT "FK_10b19ef67d297ea9de325cd4502" FOREIGN KEY ("noteId") REFERENCES "note"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel_note_pining" DROP CONSTRAINT "FK_10b19ef67d297ea9de325cd4502"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel_note_pining" DROP CONSTRAINT "FK_8125f950afd3093acb10d2db8a8"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel_following" DROP CONSTRAINT "FK_6d8084ec9496e7334a4602707e1"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel_following" DROP CONSTRAINT "FK_0e43068c3f92cab197c3d3cd86e"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note" DROP CONSTRAINT "FK_f22169eb10657bded6d875ac8f9"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel" DROP CONSTRAINT "FK_999da2bcc7efadbfe0e92d3bc19"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel" DROP CONSTRAINT "FK_823bae55bd81b3be6e05cff4383"`,
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f22169eb10657bded6d875ac8f"`);
|
||||
await queryRunner.query(`ALTER TABLE "note" DROP COLUMN "channelId"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_f36fed37d6d4cdcc68c803cd9c"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_8125f950afd3093acb10d2db8a"`);
|
||||
await queryRunner.query(`DROP TABLE "channel_note_pining"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_2e230dd45a10e671d781d99f3e"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_6d8084ec9496e7334a4602707e"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_0e43068c3f92cab197c3d3cd86"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_11e71f2511589dcc8a4d3214f9"`);
|
||||
await queryRunner.query(`DROP TABLE "channel_following"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_094b86cd36bb805d1aa1e8cc9a"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_0f58c11241e649d2a638a8de94"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_823bae55bd81b3be6e05cff438"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_29ef80c6f13bcea998447fce43"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_71cb7b435b7c0d4843317e7e16"`);
|
||||
await queryRunner.query(`DROP TABLE "channel"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class channel21596786425167 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "channel21596786425167";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel_following" ADD "readCursor" TIMESTAMP WITH TIME ZONE NOT NULL`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel_following" DROP COLUMN "readCursor"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class objectStorageSetPublicRead1597230137744 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "objectStorageSetPublicRead1597230137744";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "objectStorageSetPublicRead" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "objectStorageSetPublicRead"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class IncludingNotificationTypes1597236229720 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "IncludingNotificationTypes1597236229720";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "user_profile_includingnotificationtypes_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "includingNotificationTypes" "user_profile_includingnotificationtypes_enum" array`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "includingNotificationTypes"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "user_profile_includingnotificationtypes_enum"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class addSensitiveIndex1597385880794 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "addSensitiveIndex1597385880794";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_a7eba67f8b3fa27271e85d2e26" ON "drive_file" ("isSensitive") `,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_a7eba67f8b3fa27271e85d2e26"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class channelUnread1597459042300 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "channelUnread1597459042300";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`TRUNCATE TABLE "note_unread"`, undefined);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel_following" DROP COLUMN "readCursor"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note_unread" ADD "isMentioned" boolean NOT NULL`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note_unread" ADD "noteChannelId" character varying(32)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_25b1dd384bec391b07b74b861c" ON "note_unread" ("isMentioned") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_89a29c9237b8c3b6b3cbb4cb30" ON "note_unread" ("isSpecified") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_29e8c1d579af54d4232939f994" ON "note_unread" ("noteUserId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_6a57f051d82c6d4036c141e107" ON "note_unread" ("noteChannelId") `,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_6a57f051d82c6d4036c141e107"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_29e8c1d579af54d4232939f994"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_89a29c9237b8c3b6b3cbb4cb30"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_25b1dd384bec391b07b74b861c"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note_unread" DROP COLUMN "noteChannelId"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "note_unread" DROP COLUMN "isMentioned"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "channel_following" ADD "readCursor" TIMESTAMP WITH TIME ZONE NOT NULL`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class ChannelNoteIdDescIndex1597893996136 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "ChannelNoteIdDescIndex1597893996136";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_f22169eb10657bded6d875ac8f"`);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_note_on_channelId_and_id_desc" ON "note" ("channelId", "id" desc)`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_note_on_channelId_and_id_desc"`);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f22169eb10657bded6d875ac8f" ON "note" ("channelId") `,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class mutingNotificationTypes1600353287890 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "mutingNotificationTypes1600353287890";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "includingNotificationTypes"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "public"."user_profile_includingnotificationtypes_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "user_profile_mutingnotificationtypes_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "mutingNotificationTypes" "user_profile_mutingnotificationtypes_enum" array NOT NULL DEFAULT '{}'`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "mutingNotificationTypes"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "user_profile_mutingnotificationtypes_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "public"."user_profile_includingnotificationtypes_enum" AS ENUM('follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "includingNotificationTypes" "user_profile_includingnotificationtypes_enum" array`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class refineAbuseUserReport1603094348345 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "refineAbuseUserReport1603094348345";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_d049123c413e68ca52abe734203"`,
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_d049123c413e68ca52abe73420"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_5cd442c3b2e74fdd99dae20243"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" RENAME COLUMN "userId" TO "targetUserId"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" ADD "assigneeId" character varying(32)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" ADD "resolved" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" DROP COLUMN "comment"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" ADD "comment" character varying(2048) NOT NULL DEFAULT '{}'::varchar[]`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_2b15aaf4a0dc5be3499af7ab6a" ON "abuse_user_report" ("resolved") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_08b883dd5fdd6f9c4c1572b36de" FOREIGN KEY ("assigneeId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_08b883dd5fdd6f9c4c1572b36de"`,
|
||||
);
|
||||
await queryRunner.query(`DROP INDEX "IDX_2b15aaf4a0dc5be3499af7ab6a"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" DROP COLUMN "comment"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" ADD "comment" character varying(512) NOT NULL DEFAULT '{}'::varchar[]`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" DROP COLUMN "resolved"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" DROP COLUMN "assigneeId"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" RENAME COLUMN "targetUserId" TO "userId"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "IDX_5cd442c3b2e74fdd99dae20243" ON "abuse_user_report" ("userId", "reporterId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_d049123c413e68ca52abe73420" ON "abuse_user_report" ("userId") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_d049123c413e68ca52abe734203" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class refineAbuseUserReport21603095701770 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "refineAbuseUserReport21603095701770";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" ADD "targetUserHost" character varying(128)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" ADD "reporterHost" character varying(128)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_4ebbf7f93cdc10e8d1ef2fc6cd" ON "abuse_user_report" ("targetUserHost") `,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_f8d8b93740ad12c4ce8213a199" ON "abuse_user_report" ("reporterHost") `,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "IDX_f8d8b93740ad12c4ce8213a199"`);
|
||||
await queryRunner.query(`DROP INDEX "IDX_4ebbf7f93cdc10e8d1ef2fc6cd"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" DROP COLUMN "reporterHost"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "abuse_user_report" DROP COLUMN "targetUserHost"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class instanceThemeColor1603776877564 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "instanceThemeColor1603776877564";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "themeColor" character varying(64) DEFAULT null`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "themeColor"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class instanceFavicon1603781553011 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "instanceFavicon1603781553011";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "instance" ADD "faviconUrl" character varying(256) DEFAULT null`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "faviconUrl"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class deleteAutoWatch1604821689616 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "deleteAutoWatch1604821689616";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "autoWatch"`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "autoWatch" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class clipDescription1605408848373 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "clipDescription1605408848373";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "clip" ADD "description" character varying(2048) DEFAULT null`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "clip" DROP COLUMN "description"`);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class instancePinnedPages1605585339718 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "instancePinnedPages1605585339718";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "pinnedPages" character varying(512) array NOT NULL DEFAULT '{"/featured", "/channels", "/explore", "/pages", "/about-misskey"}'::varchar[]`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedPages"`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class instanceImages1605965516823 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "instanceImages1605965516823";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "backgroundImageUrl" character varying(512)`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "logoImageUrl" character varying(512)`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "logoImageUrl"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" DROP COLUMN "backgroundImageUrl"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class noCrawle1606191203881 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "noCrawle1606191203881";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" ADD "noCrawle" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`COMMENT ON COLUMN "user_profile"."noCrawle" IS 'Whether reject index by crawler.'`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`COMMENT ON COLUMN "user_profile"."noCrawle" IS 'Whether reject index by crawler.'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "user_profile" DROP COLUMN "noCrawle"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
export class instancePinnedClip1607151207216 implements MigrationInterface {
|
||||
constructor() {
|
||||
this.name = "instancePinnedClip1607151207216";
|
||||
}
|
||||
async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "meta" ADD "pinnedClipId" character varying(32)`,
|
||||
);
|
||||
}
|
||||
async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedClipId"`);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user