Skip to content

Instantly share code, notes, and snippets.

@tandavala
Last active June 17, 2021 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tandavala/f6bd26c83b5fb98e57684bd1c482214e to your computer and use it in GitHub Desktop.
Save tandavala/f6bd26c83b5fb98e57684bd1c482214e to your computer and use it in GitHub Desktop.
'use strict'
/** @type {import('@adonisjs/lucid/src/Schema')} */
const Schema = use('Schema')
class RecibosSchema extends Schema {
up () {
this.create('recibos', (table) => {
table.increments()
table.integer('numero').notNullable();
table.string('recibo_sigla',255).notNullable().unique()
table.string('hash',255).notNullable()
table.string('hash_control',255).notNullable().defaultTo(1)
table.string('pago',255).notNullable().defaultTo(true);
table.double('total').notNullable()
table.string('status',4).notNullable().defaultTo('N')
table.datetime('status_date').nullable()
table.text('status_reason').nullable()
table.integer('status_user_id').unsigned().nullable().references('id').inTable('users');
table.string('observacao',255).nullable()
table.boolean('is_deleted').notNullable().defaultTo(0)
table.integer('serie_id').unsigned().notNullable().references('id').inTable('series')
table.integer('cliente_id').unsigned().notNullable().references('id').inTable('clientes')
table.integer('pagamento_id').unsigned().notNullable().references('id').inTable('pagamentos')
table.integer('user_id').unsigned().notNullable().references('id').inTable('users');
table.timestamps()
})
}
down () {
this.drop('recibos')
}
}
module.exports = RecibosSchema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment