vk_agent_titles.cjs 504 Bytes
const tableName = 'vk_agent_titles'

function buildTable(t) {
  t.string('id', 64).primary()
  t.string('agent_id', 64).notNullable()
  t.string('title', 32).notNullable()
  t.string('period_key', 16).notNullable()
  t.datetime('awarded_at', { precision: 3 }).notNullable()
  t.unique(['agent_id', 'title', 'period_key'], { indexName: 'uq_vk_agent_titles_once' })
  t.check("title in ('first_relay','streak_7','weekly_mvp')", [], 'ck_vk_agent_titles_title')
}

module.exports = { tableName, buildTable }