Vitalik
2 years ago
10 changed files with 101 additions and 1 deletions
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
import { DynamicModule, Module } from '@nestjs/common' |
||||
import { TypeOrmModule } from '@nestjs/typeorm' |
||||
import { OldDBTaxonomiesService, OldDBTestService } from './services' |
||||
|
||||
@Module({}) |
||||
export class OldDatabaseSeedModule { |
||||
static forRoot(): DynamicModule { |
||||
return { |
||||
module: OldDatabaseSeedModule, |
||||
imports: [TypeOrmModule.forFeature([], 'old')], |
||||
providers: [OldDBTestService, OldDBTaxonomiesService], |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
export * from './taxonomies.service' |
||||
export * from './test.service' |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
import { Injectable } from '@nestjs/common' |
||||
import { InjectConnection } from '@nestjs/typeorm' |
||||
import { Connection } from 'typeorm' |
||||
import { IOldTaxonomy } from '../typing/interfaces' |
||||
|
||||
@Injectable() |
||||
export class OldDBTaxonomiesService { |
||||
constructor(@InjectConnection('old') private readonly connection: Connection) {} |
||||
|
||||
private async getTaxonomies(): Promise<IOldTaxonomy[]> { |
||||
const result = await this.connection.query( |
||||
` |
||||
SELECT * FROM taxonomy |
||||
|
||||
`,
|
||||
[], |
||||
) |
||||
console.log(result) |
||||
return result |
||||
} |
||||
} |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
import { Injectable } from '@nestjs/common' |
||||
import { InjectConnection } from '@nestjs/typeorm' |
||||
import { Connection } from 'typeorm' |
||||
|
||||
@Injectable() |
||||
export class OldDBTestService { |
||||
constructor(@InjectConnection('old') private readonly connection: Connection) {} |
||||
|
||||
// async onModuleInit() {
|
||||
// const result = await this.connection.query(`
|
||||
|
||||
// SELECT TABLE_NAME
|
||||
// FROM INFORMATION_SCHEMA.TABLES
|
||||
// WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_CATALOG='tasks'
|
||||
|
||||
// `)
|
||||
// }
|
||||
} |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
export * from './old-taxonomies.interfaces' |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
export interface IOldTaxonomy { |
||||
id: number |
||||
name: string |
||||
parent_id: number |
||||
type: 'reasons_task' | 'task' |
||||
created_at: number |
||||
updated_at: number |
||||
icon: string |
||||
is_deleted: boolean |
||||
is_default: boolean |
||||
} |
Loading…
Reference in new issue