-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20221130092025_payments.ts
31 lines (26 loc) · 1.02 KB
/
20221130092025_payments.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { Knex } from 'knex';
export async function up(knex: Knex): Promise<void> {
return await knex.schema.createTable('payments', (table) => {
table.increments('id');
table.enum('type', ['fund', 'withdraw']);
table.string('reference', 255).nullable();
table.string('transferCode', 255).nullable();
table.string('recipientCode', 50).nullable();
table.string('channel', 50).nullable();
table.double('amount').nullable().unsigned();
table.integer('transactionId').nullable().unsigned();
table
.integer('paymentMethod')
.references('id')
.inTable('paymentMethods')
.nullable()
.unsigned()
.comment('This payment method like fund or withdraw to/from wallets');
table.integer('customer').references('id').inTable('users').unsigned();
table.string('walletAddress').references('address').inTable('wallets');
table.timestamps(true, true, true);
});
}
export async function down(knex: Knex): Promise<void> {
return await knex.schema.dropTable('payments');
}