{"size": 627, "ext": "js", "max_stars_repo_path": "src/database/migrations/20201006111907_create_user_table.js", "max_stars_repo_name": "joaobr200/express-api", "max_stars_repo_stars_event_min_datetime": "2020-10-08T09:06:45.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-08T09:06:45.000Z", "max_issues_repo_path": "src/database/migrations/20201006111907_create_user_table.js", "max_issues_repo_name": "joaobr200/express-api", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/database/migrations/20201006111907_create_user_table.js", "max_forks_repo_name": "joaobr200/express-api", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.35, "max_line_length": 117, "alphanum_fraction": 0.6714513557}
const uuid = require("uuidv4")
const prod = process.env.NODE_ENV === "production"


exports.up = function(knex) {
  knex.raw('create extension if not exists "uuid-ossp"')
  return knex.schema.createTable("users",  table => {
    table.uuid("id").primary().notNullable().unique().defaultTo(prod ? knex.raw('uuid_generate_v4()') : uuid.uuid());
    table.string("name", 60).notNullable();
    table.string("email", 32).notNullable().unique();
    table.string("password", 32).notNullable();
  })
  
};

exports.down = function(knex) {
  knex.raw('drop extension if exists "uuid-ossp"')
  return knex.schema.dropTable("users")
};
