A no-nonsense extension of Knex migrations for use with PostgreSQL clients.
Guff extends the functionality of Knex with special column types and extra utilities for building out your schemas (e.g. triggers and functions).
- Node 8+
- Knex
const guff = require('guff')
const TABLE = 'accounts'
exports.TABLE = TABLE
exports.up = function (knex, Promise) {
return guff.createTable(
knex,
TABLE, [
guff.col('uid').primary(),
guff.col('email').unique().notNullable(),
guff.col('password', 'text').notNullable(),
guff.col('key'),
guff.col('oauth_providers', 'jsonb'),
guff.col('join_ip', 'ip').notNullable(),
guff.col('last_ip', 'ip').notNullable(),
guff.col('activated', 'boolean').defaultTo(false).notNullable(),
guff.col('created_at'),
guff.col('updated_at')
]
)
}
exports.down = function (knex) {
return guff.dropTable(knex, TABLE)
}