# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180810041316) do

  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"
  enable_extension "uuid-ossp"

  create_table "batch_line_items", force: :cascade do |t|
    t.integer  "batch_id"
    t.string   "serial_no",                         null: false
    t.string   "asset_identity",                    null: false
    t.string   "manufacture_uid",                   null: false
    t.string   "asset_type",      default: "child"
    t.datetime "encoded_at"
    t.datetime "verified_at"
    t.datetime "created_at",                        null: false
    t.datetime "updated_at",                        null: false
    t.string   "security_code"
    t.string   "barcode"
    t.boolean  "is_activated",    default: false
    t.datetime "activated_date"
    t.string   "barcode_format"
    t.index ["batch_id"], name: "index_batch_line_items_on_batch_id", using: :btree
  end

  create_table "batches", force: :cascade do |t|
    t.datetime "date",                                    null: false
    t.integer  "user_id"
    t.integer  "client_id"
    t.string   "order_ref",                               null: false
    t.boolean  "batch_start"
    t.boolean  "batch_end"
    t.string   "exported_by",                             null: false
    t.integer  "qty_processing",                          null: false
    t.integer  "qty_success",                             null: false
    t.integer  "qty_fail",                                null: false
    t.datetime "batch_start_time"
    t.datetime "batch_end_time"
    t.integer  "export_count"
    t.string   "remark"
    t.datetime "created_at",                              null: false
    t.datetime "updated_at",                              null: false
    t.string   "adult_or_child",        default: "CHILD"
    t.integer  "product_category_id"
    t.integer  "generated_qty"
    t.integer  "export_to_seller_id"
    t.datetime "export_to_seller_date"
    t.index ["client_id"], name: "index_batches_on_client_id", using: :btree
    t.index ["product_category_id"], name: "index_batches_on_product_category_id", using: :btree
    t.index ["user_id"], name: "index_batches_on_user_id", using: :btree
  end

  create_table "clients", force: :cascade do |t|
    t.string   "name",          null: false
    t.string   "email"
    t.string   "phone"
    t.string   "address"
    t.string   "secrect_key"
    t.datetime "created_at",    null: false
    t.datetime "updated_at",    null: false
    t.string   "location_code"
  end

  create_table "lookups", force: :cascade do |t|
    t.string   "name",       null: false
    t.integer  "max_value"
    t.string   "prefix"
    t.integer  "max_length"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "members", force: :cascade do |t|
    t.integer  "user_id"
    t.string   "email",                  default: "", null: false
    t.string   "encrypted_password",     default: "", null: false
    t.string   "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer  "sign_in_count",          default: 0,  null: false
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.inet     "current_sign_in_ip"
    t.inet     "last_sign_in_ip"
    t.string   "confirmation_token"
    t.datetime "confirmed_at"
    t.datetime "confirmation_sent_at"
    t.string   "unconfirmed_email"
    t.integer  "failed_attempts",        default: 0,  null: false
    t.string   "unlock_token"
    t.datetime "locked_at"
    t.datetime "created_at",                          null: false
    t.datetime "updated_at",                          null: false
    t.string   "uid"
    t.string   "session_token"
    t.index ["confirmation_token"], name: "index_members_on_confirmation_token", unique: true, using: :btree
    t.index ["email"], name: "index_members_on_email", unique: true, using: :btree
    t.index ["reset_password_token"], name: "index_members_on_reset_password_token", unique: true, using: :btree
    t.index ["uid"], name: "index_members_on_uid", unique: true, using: :btree
    t.index ["unlock_token"], name: "index_members_on_unlock_token", unique: true, using: :btree
    t.index ["user_id"], name: "index_members_on_user_id", using: :btree
  end

  create_table "product_categories", force: :cascade do |t|
    t.string  "name"
    t.integer "product_type_id"
    t.index ["product_type_id"], name: "index_product_categories_on_product_type_id", using: :btree
  end

  create_table "product_types", force: :cascade do |t|
    t.string "name"
  end

  create_table "settings", force: :cascade do |t|
    t.string "key"
    t.string "value"
    t.string "name"
  end

  create_table "users", force: :cascade do |t|
    t.string   "name",                       null: false
    t.string   "nrc"
    t.string   "email"
    t.boolean  "is_active",  default: false
    t.string   "phone"
    t.string   "address"
    t.datetime "created_at",                 null: false
    t.datetime "updated_at",                 null: false
    t.string   "user_type"
  end

end
