Firefish – migration from admin

Hey!

I had a calckey/firefish instance for myself (and for testing ff by Bobiko) … but after it grow up a bit, and DB was ~10G i decided to cut it off… and this was a bit painfull process.

So in FF you cannot make a migration if you have admin account. BUT you are admin, so you can change your files so..

packages/backend/src/server/api/endpoints/i/move.ts


export default define(meta, paramDef, async (ps, user) => {
	if (!ps.moveToAccount) throw new ApiError(meta.errors.noSuchMoveTarget);
	if (user.isAdmin) throw new ApiError(meta.errors.adminForbidden);
	if (user.movedToUri) throw new ApiError(meta.errors.alreadyMoved);

You need to remove this check „if (user.isAdmin)” just add # in front of the line

Also if you tried few times it can be tricky because of rate limiter so …

packages/backend/src/server/api/limiter.ts

export const limiter = (
	limitation: IEndpointMeta["limit"] & { key: NonNullable<string> },
	actor: string,
) =>
	new Promise<void>((ok, reject) => {
		if (process.env.NODE_ENV === "test") ok();

		const hasShortTermLimit = typeof limitation.minInterval === "number";

just remove limiter by adding new line after „new Promise<void…
and pass them only ok();

export const limiter = (
	limitation: IEndpointMeta["limit"] & { key: NonNullable<string> },
	actor: string,
) =>
	new Promise<void>((ok, reject) => {
		ok();
		if (process.env.NODE_ENV === "test") ok();

so you can play with it all the time and there is no limitation for admin to move.

Thank you, now just play with standard „after update” procedure of:

pnpm install
NODE_ENV=production pnpm run build && pnpm run migrate
pm2 ps
pm2 stop Firefish
pm2 start "NODE_ENV=production pnpm run start" --name Firefish

et voila