Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/entity/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
AfterLoad,
Column,
Entity,
Index,
Not,
OneToMany,
OneToOne,
Expand Down Expand Up @@ -86,9 +87,11 @@ export class User {
@Column({ type: 'integer', default: UserType.PLEX })
public userType: UserType;

@Index('IDX_user_plexId')
@Column({ type: 'integer', nullable: true, select: true })
public plexId?: number | null;

@Index('IDX_user_jellyfinUserId')
@Column({ type: 'varchar', nullable: true })
public jellyfinUserId?: string | null;

Expand Down
19 changes: 19 additions & 0 deletions server/migration/postgres/1776157803546-AddUserAuthIndexes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { MigrationInterface, QueryRunner } from 'typeorm';

export class AddUserAuthIndexes1776157803546 implements MigrationInterface {
name = 'AddUserAuthIndexes1776157803546';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE INDEX "IDX_user_plexId" ON "user" ("plexId") `
);
await queryRunner.query(
`CREATE INDEX "IDX_user_jellyfinUserId" ON "user" ("jellyfinUserId") `
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "public"."IDX_user_jellyfinUserId"`);
await queryRunner.query(`DROP INDEX "public"."IDX_user_plexId"`);
}
}
19 changes: 19 additions & 0 deletions server/migration/sqlite/1776157803546-AddUserAuthIndexes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { MigrationInterface, QueryRunner } from 'typeorm';

export class AddUserAuthIndexes1776157803546 implements MigrationInterface {
name = 'AddUserAuthIndexes1776157803546';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE INDEX "IDX_user_plexId" ON "user" ("plexId") `
);
await queryRunner.query(
`CREATE INDEX "IDX_user_jellyfinUserId" ON "user" ("jellyfinUserId") `
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "IDX_user_jellyfinUserId"`);
await queryRunner.query(`DROP INDEX "IDX_user_plexId"`);
}
}
Loading