billing_action_policy.cjs
840 Bytes
const tableName = 'billing_action_policy'
function buildTable(t) {
t.string('action', 48).primary()
t.bigInteger('points').unsigned().notNullable()
t.string('period_kind', 16).notNullable()
t.string('timezone', 64).nullable()
t.boolean('enabled').notNullable()
t.string('updated_by', 64).nullable()
t.datetime('created_at', { precision: 3 }).notNullable()
t.datetime('updated_at', { precision: 3 }).notNullable()
t.check("action <> ''", [], 'ck_billing_action_policy_action')
t.check('points > 0', [], 'ck_billing_action_policy_points')
t.check("period_kind in ('daily','none')", [], 'ck_billing_action_policy_period_kind')
t.check("(period_kind = 'daily' and timezone is not null) or (period_kind = 'none' and timezone is null)", [], 'ck_billing_action_policy_shape')
}
module.exports = { tableName, buildTable }