Created
November 7, 2015 16:59
-
-
Save TheNaoX/a3945aa9ae2f9f02eca0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 = function(knex, Promise) { | |
return knex.schema.hasTable('short_urls').then(function(exists) { | |
if (!exists) { | |
return knex.schema.createTable('short_urls', function(t) { | |
t.increments('id').primary(); | |
t.text('long_url'); | |
t.string('token', 11); | |
t.index(['token'], 'short_urls_token_idx') | |
t.timestamps(); | |
}); | |
} | |
}); | |
}; | |
exports.down = function(knex, Promise) { | |
return knex.schema.hasTable('short_urls').then(function(exists) { | |
if (exists) { knex.schema.dropTable('short_urls') } | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment