-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add customerId into operation entity [DEV-3732] (#507)
* Add customerId into operation entity * Add customer to operation tracking * Fix typo in filename --------- Co-authored-by: Ankur Banerjee <[email protected]>
- Loading branch information
Showing
6 changed files
with
52 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Table, TableColumn, TableForeignKey, type MigrationInterface, type QueryRunner } from 'typeorm'; | ||
|
||
export class AlterOperationTableAddCustomer1695740345990 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
const table_name = 'operation'; | ||
const table = (await queryRunner.getTable(table_name)) as Table; | ||
|
||
await queryRunner.addColumn( | ||
table_name, | ||
new TableColumn({ | ||
name: 'customerId', | ||
type: 'uuid', | ||
isNullable: true, | ||
}) | ||
); | ||
|
||
await queryRunner.createForeignKey( | ||
table, | ||
new TableForeignKey({ | ||
columnNames: ['customerId'], | ||
referencedColumnNames: ['customerId'], | ||
referencedTableName: 'customer', | ||
onDelete: 'CASCADE', | ||
}) | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
throw new Error('illegal_operation: cannot roll back initial migration'); | ||
} | ||
} |
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
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