const tableName = 'vk_escrow_payouts' function buildTable(t) { t.string('id', 64).primary() t.string('escrow_id', 64).notNullable() t.string('task_id', 64).notNullable() t.string('recipient_wallet', 64).notNullable() t.bigInteger('amount').notNullable() t.string('kind', 16).notNullable() t.string('ledger_id', 64).notNullable() t.datetime('created_at', { precision: 3 }).notNullable() t.unique(['escrow_id', 'recipient_wallet', 'kind'], { indexName: 'uq_vk_escrow_payouts_recipient_kind' }) t.unique(['ledger_id'], { indexName: 'uq_vk_escrow_payouts_ledger' }) t.index(['task_id'], 'idx_vk_escrow_payouts_task') t.check("kind in ('winner','relay_share','refund')", [], 'ck_vk_escrow_payouts_kind') t.check('amount > 0', [], 'ck_vk_escrow_payouts_amount') } module.exports = { tableName, buildTable }