{"size": 2608, "ext": "js", "max_stars_repo_path": "data/migrations/20190320013040_scannAR.js", "max_stars_repo_name": "jtb36688/scannAR-BE", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "data/migrations/20190320013040_scannAR.js", "max_issues_repo_name": "jtb36688/scannAR-BE", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "data/migrations/20190320013040_scannAR.js", "max_forks_repo_name": "jtb36688/scannAR-BE", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.421686747, "max_line_length": 57, "alphanum_fraction": 0.5885736196}
exports.up = function(knex, Promise) {
  return knex.schema
    .createTable("users", column => {
      column.increments("identifier");
      column
        .string("username", 32)
        .notNullable()
        .unique();
      column.string("password", 32).notNullable();
      column.string("fullName", 128).defaultTo("");
      column.string("email", 128).defaultTo("");
      column.boolean("oAuth").defaultTo(false);
    })
    .createTable("user_addresses", column => {
      column.increments("identifier");
      column.string("label", 12).notNullable();
      column.string("address", 512).notNullable();
      column
        .integer("userId")
        .unsigned()
        .references("id")
        .inTable("users")
        .onDelete("CASCADE")
        .onUpdate("CASCADE");
    })
    .createTable("products", column => {
      column.increments("identifier");
      column.string("name", 128).notNullable();
      column.string("description", 512).defaultTo("");
      column.integer("weight");
      column.integer("length");
      column.integer("width");
      column.integer("height");
      column.integer("value");
      column.string("manufacturerId", 512).defaultTo("");
      column.boolean("fragile").defaultTo(false);
      column
        .integer("userId")
        .unsigned()
        .references("id")
        .inTable("users")
        .onDelete("CASCADE")
        .onUpdate("CASCADE");
    })
    .createTable("product_assets", column => {
      column.increments("identifier");
      column.string("imageURL", 512).defaultTo("");
      column
        .integer("productId")
        .unsigned()
        .references("id")
        .inTable("products")
        .onDelete("CASCADE")
        .onUpdate("CASCADE");
    })
    .createTable("shipments", column => {
      column.increments("identifier");
      column.date("dateShipped", 24);
      column
        .integer("productId")
        .unsigned()
        .references("id")
        .inTable("products")
        .onDelete("CASCADE")
        .onUpdate("CASCADE");
      column.string("shippedFrom", 512).defaultTo("");
      column.string("shippedTo", 512).defaultTo("");
      column.string("trackingNumber", 128).defaultTo("");
      column.string("carrierName", 128).defaultTo("");
      column.string("shippingType", 128).defaultTo("");
      column.integer("status")
    })
};

exports.down = function(knex, Promise) {
  return knex.schema
    .dropTableIfExists("users")
    .dropTableIfExists("user_addresses")
    .dropTableIfExists("products")
    .dropTableIfExists("product_assets")
    .dropTableIfExists("shipments")
};
