Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,7 @@ export class BigBangBaselineMigration1748000000000
`CREATE UNIQUE INDEX "uq_categories_uex_id" ON "station_category" ("uex_id") WHERE "uex_id" IS NOT NULL`,
);
await queryRunner.query(
Comment thread
GitAddRemote marked this conversation as resolved.
`CREATE UNIQUE INDEX "uq_categories_section_type" ON "station_category" ("type", "name") WHERE "is_section" = TRUE`,
`CREATE UNIQUE INDEX "uq_categories_section_type" ON "station_category" (COALESCE("type", ''), "name") WHERE "is_section" = TRUE`,
);
await queryRunner.query(
`CREATE INDEX "idx_categories_parent" ON "station_category" ("parent_id")`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

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

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP INDEX IF EXISTS "uq_categories_section_type"`,
);
await queryRunner.query(
`CREATE UNIQUE INDEX "uq_categories_section_type" ON "station_category" (COALESCE("type", ''), "name") WHERE "is_section" = TRUE`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP INDEX IF EXISTS "uq_categories_section_type"`,
);
await queryRunner.query(
`CREATE UNIQUE INDEX "uq_categories_section_type" ON "station_category" ("type", "name") WHERE "is_section" = TRUE`,
);
}
}
2 changes: 2 additions & 0 deletions backend/src/modules/catalog-etl/catalog-etl.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { SpaceStationsSyncStep } from './steps/space-stations-sync.step';
import { OutpostsSyncStep } from './steps/outposts-sync.step';
import { PoisSyncStep } from './steps/pois-sync.step';
import { JumpPointsSyncStep } from './steps/jump-points-sync.step';
import { CategoriesSyncStep } from './steps/categories-sync.step';
import { UexSyncModule } from '../uex-sync/uex-sync.module';

@Module({
Expand All @@ -37,6 +38,7 @@ import { UexSyncModule } from '../uex-sync/uex-sync.module';
OutpostsSyncStep,
PoisSyncStep,
JumpPointsSyncStep,
CategoriesSyncStep,
],
exports: [CatalogEtlService],
})
Expand Down
5 changes: 5 additions & 0 deletions backend/src/modules/catalog-etl/catalog-etl.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { SpaceStationsSyncStep } from './steps/space-stations-sync.step';
import { OutpostsSyncStep } from './steps/outposts-sync.step';
import { PoisSyncStep } from './steps/pois-sync.step';
import { JumpPointsSyncStep } from './steps/jump-points-sync.step';
import { CategoriesSyncStep } from './steps/categories-sync.step';

function buildMockRun(overrides: Partial<EtlRun> = {}): EtlRun {
const run = new EtlRun();
Expand Down Expand Up @@ -131,6 +132,10 @@ describe('CatalogEtlService', () => {
provide: JumpPointsSyncStep,
useValue: { name: 'jump-points', execute: jest.fn() },
},
{
provide: CategoriesSyncStep,
useValue: { name: 'categories-sync', execute: jest.fn() },
},
],
}).compile();

Expand Down
3 changes: 3 additions & 0 deletions backend/src/modules/catalog-etl/catalog-etl.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { SpaceStationsSyncStep } from './steps/space-stations-sync.step';
import { OutpostsSyncStep } from './steps/outposts-sync.step';
import { PoisSyncStep } from './steps/pois-sync.step';
import { JumpPointsSyncStep } from './steps/jump-points-sync.step';
import { CategoriesSyncStep } from './steps/categories-sync.step';

@Injectable()
export class CatalogEtlService {
Expand All @@ -43,6 +44,7 @@ export class CatalogEtlService {
private readonly outpostsSyncStep: OutpostsSyncStep,
private readonly poisSyncStep: PoisSyncStep,
private readonly jumpPointsSyncStep: JumpPointsSyncStep,
private readonly categoriesSyncStep: CategoriesSyncStep,
) {
this.ETL_STEPS = [
factionsSyncStep,
Expand All @@ -57,6 +59,7 @@ export class CatalogEtlService {
outpostsSyncStep,
poisSyncStep,
jumpPointsSyncStep,
categoriesSyncStep,
];
}

Expand Down
Loading
Loading