Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (34 sloc) 1.1 KB
exports.up = function(knex, Promise) {
return knex.schema
.createTable('Users', function(table) {
table.integer('user_id').primary();
table.string('name').notNull();
table.string('handle').notNull();
table.string('location').notNull();
table.string('description').notNull();
table.integer('followers_count').notNull();
table.integer('friends_count').notNull();
table.integer('favourites_count').notNull();
table.string('following');
})
.then(() => {
return knex.schema.createTable('Tweets', function(table) {
table
.uuid('tweet_id')
.notNullable()
.primary();
table.string('tweet').notNull();
table.boolean('retweeted').notNull();
table.integer('retweet_count').notNull();
table.boolean('favorited').notNull();
table.string('created_at').notNull();
table.integer('user_id').notNull();
});
});
};
exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.dropTableIfExists('Users'),
knex.schema.dropTableIfExists('Tweets'),
]);
};