Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 23, 2020 10:20
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 velotiotech/2c4832d4a5322e9d8c522c409f169f09 to your computer and use it in GitHub Desktop.
Save velotiotech/2c4832d4a5322e9d8c522c409f169f09 to your computer and use it in GitHub Desktop.
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