forked from kokonect-link/cherrypick
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
リモートクリップのお気に入り登録 (kokonect-link#438)
- Loading branch information
1 parent
142f9e5
commit 4838494
Showing
15 changed files
with
277 additions
and
102 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
packages/backend/migration/1726276463152-ClipFavoriteRemote.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* SPDX-FileCopyrightText: syuilo and misskey-project, yojo-art team | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
export class clipFavoriteRemote1726276463152 { | ||
name = 'clipFavoriteRemote1726276463152' | ||
|
||
async up(queryRunner) { | ||
await queryRunner.query(`CREATE TABLE "clip_favorite_remote" ("id" character varying(32) NOT NULL, "userId" character varying(32) NOT NULL, "clipId" character varying(32) NOT NULL, "host" character varying(128) NOT NULL, CONSTRAINT "PK_5cfc42c4522f5253fd759947ec" PRIMARY KEY ("id"))`); | ||
await queryRunner.query(`CREATE INDEX "IDX_99c7abefa295355f5725ce959f" ON "clip_favorite_remote" ("userId") `); | ||
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_7ca9b4f7544e2b2fdf959bc9f4" ON "clip_favorite_remote" ("userId", "clipId","host") `); | ||
await queryRunner.query(`ALTER TABLE "clip_favorite_remote" ADD CONSTRAINT "FK_99c7abefa295355f5725ce959f1" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); | ||
} | ||
|
||
async down(queryRunner) { | ||
await queryRunner.query(`ALTER TABLE "clip_favorite_remote" DROP CONSTRAINT "FK_99c7abefa295355f5725ce959f1"`); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_7ca9b4f7544e2b2fdf959bc9f4"`); | ||
await queryRunner.query(`DROP INDEX "public"."IDX_99c7abefa295355f5725ce959f"`); | ||
await queryRunner.query(`DROP TABLE "clip_favorite_remote"`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* SPDX-FileCopyrightText: syuilo and misskey-project, yojo-art team | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; | ||
import { id } from './util/id.js'; | ||
import { MiUser } from './User.js'; | ||
|
||
@Entity('clip_favorite_remote') | ||
@Index(['userId', 'clipId', 'host'], { unique: true }) | ||
export class MiClipFavoriteRemote { | ||
@PrimaryColumn(id()) | ||
public id: string; | ||
|
||
@Index() | ||
@Column(id()) | ||
public userId: MiUser['id']; | ||
|
||
@ManyToOne(type => MiUser, { | ||
onDelete: 'CASCADE', | ||
}) | ||
@JoinColumn() | ||
public user: MiUser | null; | ||
|
||
@Column('varchar', { | ||
length: 32, | ||
}) | ||
public clipId: string; | ||
|
||
@Column('varchar', { | ||
length: 128, | ||
}) | ||
public host: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.