mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
chore: add index to asset.createdAt
This commit is contained in:
@@ -130,14 +130,6 @@ const create = (path: string, up: string[], down: string[]) => {
|
|||||||
const compare = async () => {
|
const compare = async () => {
|
||||||
const configRepository = new ConfigRepository();
|
const configRepository = new ConfigRepository();
|
||||||
const { database } = configRepository.getEnv();
|
const { database } = configRepository.getEnv();
|
||||||
database.config = {
|
|
||||||
connectionType: 'parts',
|
|
||||||
database: 'immich',
|
|
||||||
host: 'database',
|
|
||||||
password: 'postgres',
|
|
||||||
username: 'postgres',
|
|
||||||
port: 5432,
|
|
||||||
};
|
|
||||||
const db = postgres(asPostgresConnectionConfig(database.config));
|
const db = postgres(asPostgresConnectionConfig(database.config));
|
||||||
|
|
||||||
const source = schemaFromCode({ overrides: true, namingStrategy: 'default' });
|
const source = schemaFromCode({ overrides: true, namingStrategy: 'default' });
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ export async function up(db: Kysely<any>): Promise<void> {
|
|||||||
);`.execute(db);
|
);`.execute(db);
|
||||||
await sql`CREATE INDEX "integrity_report_assetId_idx" ON "integrity_report" ("assetId");`.execute(db);
|
await sql`CREATE INDEX "integrity_report_assetId_idx" ON "integrity_report" ("assetId");`.execute(db);
|
||||||
await sql`CREATE INDEX "integrity_report_fileAssetId_idx" ON "integrity_report" ("fileAssetId");`.execute(db);
|
await sql`CREATE INDEX "integrity_report_fileAssetId_idx" ON "integrity_report" ("fileAssetId");`.execute(db);
|
||||||
|
await sql`CREATE INDEX "asset_createdAt_idx" ON "asset" ("createdAt");`.execute(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<any>): Promise<void> {
|
||||||
await sql`DROP TABLE "integrity_report";`.execute(db);
|
await sql`DROP TABLE "integrity_report";`.execute(db);
|
||||||
|
await sql`DROP INDEX "asset_createdAt_idx";`.execute(db);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export class AssetTable {
|
|||||||
@UpdateDateColumn()
|
@UpdateDateColumn()
|
||||||
updatedAt!: Generated<Timestamp>;
|
updatedAt!: Generated<Timestamp>;
|
||||||
|
|
||||||
@CreateDateColumn()
|
@CreateDateColumn({ index: true })
|
||||||
createdAt!: Generated<Timestamp>;
|
createdAt!: Generated<Timestamp>;
|
||||||
|
|
||||||
@Column({ index: true })
|
@Column({ index: true })
|
||||||
|
|||||||
Reference in New Issue
Block a user