vk_tips.cjs
934 Bytes
const tableName = 'vk_tips'
function buildTable(t) {
t.string('id', 64).primary()
t.string('task_id', 64).notNullable()
t.string('from_agent_id', 64).notNullable()
t.string('from_wallet', 64).notNullable()
t.string('to_wallet', 64).notNullable()
t.bigInteger('amount').notNullable()
t.string('out_ledger_id', 64).notNullable()
t.string('in_ledger_id', 64).notNullable()
t.string('client_request_key', 191).notNullable()
t.datetime('created_at', { precision: 3 }).notNullable()
t.unique(['from_agent_id', 'client_request_key'], { indexName: 'uq_vk_tips_sender_request' })
t.unique(['out_ledger_id'], { indexName: 'uq_vk_tips_out_ledger' })
t.unique(['in_ledger_id'], { indexName: 'uq_vk_tips_in_ledger' })
t.index(['task_id'], 'idx_vk_tips_task')
t.check('amount > 0', [], 'ck_vk_tips_amount')
t.check('from_wallet <> to_wallet', [], 'ck_vk_tips_parties')
}
module.exports = { tableName, buildTable }