Created
June 23, 2020 10:20
-
-
Save velotiotech/2c4832d4a5322e9d8c522c409f169f09 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
exports.up = knex => { | |
return knex.schema | |
.createTable('persons', table => { | |
table.increments('id').primary(); | |
table | |
.integer('parentId') | |
.unsigned() | |
.references('id') | |
.inTable('persons') | |
.onDelete('SET NULL') | |
.index(); | |
table.string('firstName'); | |
table.string('lastName'); | |
table.integer('age'); | |
table.json('address'); | |
}) | |
}; | |
exports.down = knex => { | |
return knex.schema | |
.dropTableIfExists('persons'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment