Skip to content

Instantly share code, notes, and snippets.

@diego3g
Last active July 19, 2018 13:51
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 diego3g/0f9643109fb0cad16d76f284b2887a24 to your computer and use it in GitHub Desktop.
Save diego3g/0f9643109fb0cad16d76f284b2887a24 to your computer and use it in GitHub Desktop.
'use strict'
const Schema = use('Schema')
class PropertySchema extends Schema {
up () {
this.create('properties', table => {
table.increments()
table
.integer('user_id')
.unsigned()
.references('id')
.inTable('users')
.onUpdate('CASCADE')
.onDelete('CASCADE')
table.string('title').notNullable()
table.string('address').notNullable()
table.decimal('price').notNullable()
table.decimal('latitude', 9, 6).notNullable()
table.decimal('longitude', 9, 6).notNullable()
table.timestamps()
})
}
down () {
this.drop('properties')
}
}
module.exports = PropertySchema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment