guff

0.1.6 • Public • Published

😤 guff

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).

Requirements

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)
}

Readme

Keywords

none

Package Sidebar

Install

npm i guff

Weekly Downloads

2

Version

0.1.6

License

MIT

Unpacked Size

206 kB

Total Files

145

Last publish

Collaborators

  • jaredlunde