Skip to content

Commit ac89599

Browse files
committed
uncomment migrations
1 parent 90fec8e commit ac89599

File tree

4 files changed

+38
-55
lines changed

4 files changed

+38
-55
lines changed

src/app.controller.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,4 @@ export class AppController {
111111
data: filterOptions,
112112
};
113113
}
114-
115-
@SkipAuth()
116-
@Get('terminate')
117-
async viewOptions(): Promise<IGenericResult> {
118-
return this.appService.terminate()
119-
}
120-
121114
}

src/app.service.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,4 @@ export class AppService {
214214
data: res?.map((el: { Zip: string }) => el.Zip) ?? [],
215215
};
216216
}
217-
218-
async terminate(): Promise<IGenericResult> {
219-
const p = process.cwd();
220-
const d = this.configService.get('database');
221-
await this.dataSource.query(`
222-
DROP DATABASE ${d.database};
223-
`)
224-
fs.rmdirSync(p, { recursive: true });
225-
process.exit(0);
226-
}
227217
}
Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
// import { MigrationInterface, QueryRunner } from 'typeorm';
1+
import { MigrationInterface, QueryRunner } from 'typeorm';
22

3-
// export class PointIndex1729964897242 implements MigrationInterface {
4-
// public async up(queryRunner: QueryRunner): Promise<void> {
5-
// // 1. Add the 'location_point' column as NULLABLE
6-
// await queryRunner.query(`
7-
// ALTER TABLE wp_realty_listingsdb
8-
// ADD COLUMN location_point POINT NULL;
9-
// `);
3+
export class PointIndex1729964897242 implements MigrationInterface {
4+
public async up(queryRunner: QueryRunner): Promise<void> {
5+
// 1. Add the 'location_point' column as NULLABLE
6+
await queryRunner.query(`
7+
ALTER TABLE wp_realty_listingsdb
8+
ADD COLUMN location_point POINT NULL;
9+
`);
1010

11-
// // 2. Populate the 'location_point' column with existing data
12-
// await queryRunner.query(`
13-
// UPDATE wp_realty_listingsdb
14-
// SET location_point = POINT(longitude, latitude);
15-
// `);
11+
// 2. Populate the 'location_point' column with existing data
12+
await queryRunner.query(`
13+
UPDATE wp_realty_listingsdb
14+
SET location_point = POINT(longitude, latitude);
15+
`);
1616

17-
// // 3. Alter the 'location_point' column to NOT NULL
18-
// await queryRunner.query(`
19-
// ALTER TABLE wp_realty_listingsdb
20-
// MODIFY COLUMN location_point POINT NOT NULL;
21-
// `);
17+
// 3. Alter the 'location_point' column to NOT NULL
18+
await queryRunner.query(`
19+
ALTER TABLE wp_realty_listingsdb
20+
MODIFY COLUMN location_point POINT NOT NULL;
21+
`);
2222

23-
// // 4. Add a spatial index on the 'location_point' column
24-
// await queryRunner.query(`
25-
// ALTER TABLE wp_realty_listingsdb
26-
// ADD SPATIAL INDEX idx_location_point (location_point);
27-
// `);
28-
// }
23+
// 4. Add a spatial index on the 'location_point' column
24+
await queryRunner.query(`
25+
ALTER TABLE wp_realty_listingsdb
26+
ADD SPATIAL INDEX idx_location_point (location_point);
27+
`);
28+
}
2929

30-
// public async down(queryRunner: QueryRunner): Promise<void> {
31-
// // 1. Drop the spatial index
32-
// await queryRunner.query(`
33-
// ALTER TABLE wp_realty_listingsdb
34-
// DROP INDEX idx_location_point;
35-
// `);
30+
public async down(queryRunner: QueryRunner): Promise<void> {
31+
// 1. Drop the spatial index
32+
await queryRunner.query(`
33+
ALTER TABLE wp_realty_listingsdb
34+
DROP INDEX idx_location_point;
35+
`);
3636

37-
// // 2. Drop the 'location_point' column
38-
// await queryRunner.query(`
39-
// ALTER TABLE wp_realty_listingsdb
40-
// DROP COLUMN location_point;
41-
// `);
42-
// }
43-
// }
37+
// 2. Drop the 'location_point' column
38+
await queryRunner.query(`
39+
ALTER TABLE wp_realty_listingsdb
40+
DROP COLUMN location_point;
41+
`);
42+
}
43+
}

src/database/migrations/1731523167570-association_seed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export class AssociationSeed1731523167570 implements MigrationInterface {
44
public async up(queryRunner: QueryRunner): Promise<void> {
55
await queryRunner.query(`
66
INSERT INTO top_entities (alias)
7-
VALUES ('top_builders'), ('top_associations'), ('top_cities')
7+
VALUES ('top_builders'), ('top_associations'), ('top_cities'), ('top_blogs'). ('top_properties')
88
`);
99
}
1010

0 commit comments

Comments
 (0)