Skip to content

Commit

Permalink
Creating association table and adjusting attributes pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagocmoreira committed May 10, 2019
1 parent e5978ae commit b51dcbf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion migrations/20190509021053_create_table_reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function up (knex) {
table.uuid('id').primary()
table.timestamp('start')
table.timestamp('end')
table.string('alertLevel')
table.string('alert_level')
table.timestamps(false, true)
})
}
Expand Down
21 changes: 21 additions & 0 deletions migrations/20190510013743_create_association_table_analysis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function up (knex) {
return knex.schema.createTable('analysis', (table) => {
table.uuid('id').primary()
table.integer('position_start')
table.integer('position_end')
table.string('image_path')
table.string('state')
table.uuid('report_id').references('id').inTable('reports').onDelete('CASCADE')
table.uuid('cable_id').references('id').inTable('cables').onDelete('CASCADE')
table.timestamps(false, true)
})
}

function down (knex) {
return knex.schema.dropTable('analysis')
}

export {
up,
down
}

0 comments on commit b51dcbf

Please sign in to comment.