-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46b97d5
commit 9fe5daf
Showing
12 changed files
with
156 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...p-db-credentials/src/common/data-source/migrations/1739349524222-create-db-publication.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class CreateDbPublication1739349524222 implements MigrationInterface { | ||
name = 'CreateDbPublication1739349524222' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TABLE "db_credentials_mgr"."db_publication" ("id" SERIAL NOT NULL, "publication" character varying NOT NULL, "slot" character varying NOT NULL, "db_id" uuid NOT NULL, "created_by" character varying NOT NULL, "created_date" TIMESTAMP NOT NULL DEFAULT now(), "modified_by" character varying NOT NULL, "modified_date" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_2c00d40454a74a07284f53c3e41" UNIQUE ("publication", "db_id"), CONSTRAINT "PK_692b25da07a6fce963c98a1c445" PRIMARY KEY ("id"))` | ||
) | ||
await queryRunner.query( | ||
`ALTER TABLE "db_credentials_mgr"."db_publication" ADD CONSTRAINT "FK_90722678a5543b197d244e87fab" FOREIGN KEY ("db_id") REFERENCES "db_credentials_mgr"."db"("id") ON DELETE CASCADE ON UPDATE NO ACTION` | ||
) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "db_credentials_mgr"."db_publication" DROP CONSTRAINT "FK_90722678a5543b197d244e87fab"` | ||
) | ||
await queryRunner.query(`DROP TABLE "db_credentials_mgr"."db_publication"`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
functions/alp-db-credentials/src/db/entity/db-publication.entity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Entity, Column, ManyToOne, PrimaryGeneratedColumn, JoinColumn, Unique, type Relation } from 'typeorm' | ||
import { Database } from './db.entity' | ||
import { Audit } from '../../common/entity' | ||
|
||
@Entity() | ||
@Unique(['publication', 'dbId']) | ||
export class DbPublication extends Audit { | ||
@PrimaryGeneratedColumn() | ||
id: number | ||
|
||
@Column() | ||
publication: string | ||
|
||
@Column() | ||
slot: string | ||
|
||
@Column({ name: 'db_id' }) | ||
dbId: string | ||
|
||
@ManyToOne(() => Database, db => db, { | ||
onDelete: 'CASCADE' | ||
}) | ||
@JoinColumn({ name: 'db_id' }) | ||
db: Relation<Database> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './db.entity' | ||
export * from './db-extra.entity' | ||
export * from './db-credential.entity' | ||
export * from './db-publication.entity' | ||
export * from './db-vocab-schema.entity' |
11 changes: 11 additions & 0 deletions
11
functions/alp-db-credentials/src/db/repository/db-publication.repository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Service } from 'typedi' | ||
import { Repository } from 'typeorm' | ||
import dataSource from '../../common/data-source/data-source' | ||
import { DbPublication } from '../entity' | ||
|
||
@Service() | ||
export class DbPublicationRepository extends Repository<DbPublication> { | ||
constructor() { | ||
super(DbPublication, dataSource.createEntityManager()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './db.repository' | ||
export * from './db-extra.repository' | ||
export * from './db-credential.repository' | ||
export * from './db-publication.repository' | ||
export * from './db-vocab-schema.repository' |
Oops, something went wrong.