Last active
July 19, 2018 13:51
-
-
Save diego3g/0f9643109fb0cad16d76f284b2887a24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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