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/ac2338d19296484b77da6bd6405beb1e to your computer and use it in GitHub Desktop.
Save diego3g/ac2338d19296484b77da6bd6405beb1e to your computer and use it in GitHub Desktop.
'use strict'
const Schema = use('Schema')
class ImageSchema extends Schema {
up () {
this.create('images', table => {
table.increments()
table
.integer('property_id')
.unsigned()
.references('id')
.inTable('properties')
.onUpdate('CASCADE')
.onDelete('CASCADE')
table.string('path').notNullable()
table.timestamps()
})
}
down () {
this.drop('images')
}
}
module.exports = ImageSchema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment