geekelo / geekelo/dsa_practice
ESCROW
- Dominant language
- No language data
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
### [P2P-API] Add ecrowAmount and tradeEscrow amount to profiles
**RUN**
`npx typeorm migration:create src/migrations/AddEscrowAmountsToProfiles`
`npx typeorm migration:create src/migrations/AddTradeEscrowAmountsToProfiles`
**THEN MODIFY MIGRATION**
```
import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';
export class AddEscrowAmountsToProfiles1632839270312 implements MigrationInterface {
name = 'AddEscrowAmountsToProfiles1632839270312';
public async up(queryRunner: QueryRunner): Promise {
const checkEscrowAmountColumn = await queryRunner.hasColumn('profile', 'escrowAmount');
if (!checkEscrowAmountColumn) {
await queryRunner.addColumn(
'profiles',
new TableColumn({
name: 'escrowAmount',
type: 'decimal',
precision: 10,
scale: 2,
default: 0,
isNullable: true,
}),
);
}
const checkTradeEscrowAmountColumn = await queryRunner.hasColumn('profiles', 'tradeEscrowAmount');
if (!checkTradeEscrowAmountColumn) {
await queryRunner.addColumn(
'profiles',
new TableColumn({
name: 'tradeEscrowAmount',
type: 'decimal',
precision: 10,
scale: 2,
default: 0,
isNullable: true,
}),
);
}
}
public async down(queryRunner: QueryRunner): Promise {
const checkEscrowAmountColumn = await queryRunner.hasColumn('profiles', 'escrowAmount');
if (checkEscrowAmountColumn) {
await queryRunner.dropColumn('profiles', 'escrowAmount');
}
const checkTradeEscrowAmountColumn = await queryRunner.hasColumn('profiles', 'tradeEscrowAmount');
if (checkTradeEscrowAmountColumn) {
await queryRunner.dropColumn('profiles', 'tradeEscrowAmount');
}
}
}
```
- RUN
`yarn run typeorm:run-migrations`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.