Bläddra i källkod

Check warnings through erd gem

Dalia Carlon 9 år sedan
förälder
incheckning
810da6f233

+ 2 - 2
Gemfile.lock

@@ -77,12 +77,12 @@ GEM
     builder (3.2.2)
     byebug (6.0.2)
     cancan (1.6.10)
-    childprocess (0.5.9)
-      ffi (~> 1.0, >= 1.0.11)
     carrierwave (1.0.0.rc)
       activemodel (>= 4.0.0)
       activesupport (>= 4.0.0)
       mime-types (>= 1.16)
+    childprocess (0.5.9)
+      ffi (~> 1.0, >= 1.0.11)
     choice (0.2.0)
     climate_control (0.0.3)
       activesupport (>= 3.0)

+ 13 - 12
app/models/available_product.rb

@@ -1,17 +1,18 @@
 class AvailableProduct < ActiveRecord::Base
-    
-    belongs_to :product
-    belongs_to :pointsale
-    belongs_to :products_variant_id
-    has_many :categories, :through => :product
 
-    audited
-    validates :price_sale, :presence => { :message => "Debe especificar el precio de venta para su punto de venta"},  :numericality => { :message => "El precio debe ser mayor que el precio de venta base.", :greater_than => :get_price }, :on => :update_price
+  belongs_to :product
+  belongs_to :pointsale
 
- 	scope :activos, -> { joins(:product).where( "products.status = 1").order("products.name") }
+  has_many :categories, :through => :product
 
-    protected
-    	def get_price
-    		product.price_sale
-    	end
+  audited
+
+  validates :price_sale, :presence => { :message => "Debe especificar el precio de venta para su punto de venta"},  :numericality => { :message => "El precio debe ser mayor que el precio de venta base.", :greater_than => :get_price }, :on => :update_price
+  scope :activos, -> { joins(:product).where( "products.status = 1").order("products.name") }
+
+  protected
+
+  def get_price
+    product.price_sale
+  end
 end

+ 8 - 8
app/models/credit.rb

@@ -1,12 +1,12 @@
 class Credit < ActiveRecord::Base
-    belongs_to :customer
-    belongs_to :pointsale
-    belongs_to :sale
-
-    has_and_belongs_to_many :credit_payments
-    has_many :cash_registers_moves, :through => :credit_payments
-    
-    enum status: [ :active, :cancelled, :expired ]
+  belongs_to :customer
+  belongs_to :pointsale
+  belongs_to :sale
+
+  has_many :credit_payments
+  has_many :cash_registers_moves, :through => :credit_payments
+
+  enum status: [ :active, :cancelled, :expired ]
 
 	scope :debtors, -> { where( "rest > 0").group(:customer_id).sum(:rest) }
 

+ 4 - 4
app/models/credit_payment.rb

@@ -1,11 +1,11 @@
 class CreditPayment < ActiveRecord::Base
-    belongs_to :customer
+  belongs_to :customer
 
-    belongs_to :pointsale
-    belongs_to :user
+  belongs_to :pointsale
+  belongs_to :user
+  belongs_to :credit
 
 	has_one :cash_registers_move
-	has_and_belongs_to_many :credits
 
  	enum status: [ :active, :cancelled ]
 end

+ 1 - 1
app/models/open_cash_register.rb

@@ -5,7 +5,7 @@ class OpenCashRegister < ActiveRecord::Base
 	has_many :sales
 	has_many :sales_details, :through => :sales
 	has_many :products, :through => :sales_details
-	has_many :categories, :through => :proucts
+	has_many :categories, :through => :products
 	has_many :expenses
 	has_many :pre_sales
 	has_many :cash_outs

+ 2 - 2
app/models/sale.rb

@@ -7,12 +7,12 @@ class Sale < ActiveRecord::Base
 	has_many :cash_registers_moves
 	has_many :inventories_moves
 	has_many :sales_details
-  	has_many :products, :through => :sales_details
+  has_many :products, :through => :sales_details
 	has_one :credit
 	has_many :credit_payments, :through => :credit
 	has_one :sales_sellercommission
 	has_many :products_returns
-	has_many :pointsales, :through => :open_cash_registers
+	has_many :pointsales, :through => :open_cash_register
 
   	##--- Llevar registro de Actividad del usuario
 	audited

+ 1 - 1
app/models/sales_detail.rb

@@ -4,7 +4,7 @@ class SalesDetail < ActiveRecord::Base
 	belongs_to :special_price
 
 
-	has_many :pointsales, :through => :sales
+	has_many :pointsales, :through => :sale
 
 	enum status: [ :inactive, :active ]
 

+ 15 - 15
app/models/user.rb

@@ -1,5 +1,5 @@
 class User < ActiveRecord::Base
-	
+
 	# Include default devise modules. Others available are:
 	# :confirmable, :lockable, :timeoutable and :omniauthable
 	devise :database_authenticatable, :registerable,
@@ -8,14 +8,14 @@ class User < ActiveRecord::Base
 
 	before_update :warehouse_or_pointsale
 
-	#-- Associations 		 
+	#-- Associations
 	belongs_to :pointsale
-	belongs_to :warehouse	
-	has_many :pre_sales	
+	belongs_to :warehouse
+	has_many :pre_sales
 	has_many :product_wastes
-	has_many :pre_purchases	
+	has_many :pre_purchases
 	has_many :open_cash_registers
-	has_many :credit_payments	
+	has_many :credit_payments
 	has_many :cash_outs
 	has_many :special_prices
 	has_many :transfers
@@ -24,8 +24,8 @@ class User < ActiveRecord::Base
 
 	enum status: [ :erased, :active, :inactive ]
 	##--- Llevar registro de Actividad del usuario
-	audited 
-	
+	audited
+
 	##--- Validaciones previas de guardar
 	attr_accessor :skip_validations_from_pointsale
 	attr_accessor :skip_validations_when_edit
@@ -35,15 +35,15 @@ class User < ActiveRecord::Base
 	# validates_presence_of :pointsale_id, message: "Debe seleccionar el punto de venta al que pertenecerá el usuario.", :on => [:create, :update], unless: :skip_validations_from_pointsale
 	validates_presence_of :usertype, message: "Debe seleccionar el tipo de usuario, con este se determinara los permisos que tendrá dentro del sistema.", :on => [:create, :update], unless: :skip_validations_from_pointsale
 
-    validates :pointsale_id , presence: { message: "Debe seleccionar un almacén o un punto de venta al que pertenecerá el usuario." }, 
-    :if => Proc.new {|c| c.warehouse_id.blank?}, :on => [:create, :update], unless: :skip_validations_from_pointsale
-    validates :warehouse_id , presence: { message: "Debe seleccionar un almacén o un punto de venta al que pertenecerá el usuario." }, 
-    :if => Proc.new {|c| c.pointsale_id.blank?}, :on => [:create, :update], unless: :skip_validations_from_pointsale
+  validates :pointsale_id , presence: { message: "Debe seleccionar un almacén o un punto de venta al que pertenecerá el usuario." },
+  :if => Proc.new {|c| c.warehouse_id.blank?}, :on => [:create, :update], unless: :skip_validations_from_pointsale
+  validates :warehouse_id , presence: { message: "Debe seleccionar un almacén o un punto de venta al que pertenecerá el usuario." },
+  :if => Proc.new {|c| c.pointsale_id.blank?}, :on => [:create, :update], unless: :skip_validations_from_pointsale
 
 	validates :userid, uniqueness: { message: "El usuario ya fue utilizado, favor de especificar otro." }
 
 	def full_name
-		"#{self.first_name} #{last_name}"
+		"#{first_name} #{last_name}"
 	end
 
 	def get_open_cash_register
@@ -51,9 +51,9 @@ class User < ActiveRecord::Base
 	end
 
 	def warehouse_or_pointsale
-		if self.pointsale_id.present?
+		if pointsale_id.present?
 			self.warehouse_id = nil
-		elsif self.warehouse_id.present?
+		elsif warehouse_id.present?
 			self.pointsale_id = nil
 		end
 	end

+ 11 - 6
db/migrate/20161214181936_change_columns_from_products_and_pointsales.rb

@@ -2,13 +2,18 @@ class ChangeColumnsFromProductsAndPointsales < ActiveRecord::Migration
   def change
   	if column_exists?(:products, :image)
   		remove_column :products, :image
-	end
+  	end
 
-	if column_exists?(:pointsales, :image)
-  		remove_column :pointsales, :image
-	end
+  	if column_exists?(:pointsales, :image)
+    	remove_column :pointsales, :image
+  	end
 
-	add_column :products, :img_product, :string
-	add_column :pointsales, :img_pointsale, :string
+    unless column_exists?(:products, :img_product)
+  	 add_column :products, :img_product, :string
+    end
+
+    unless column_exists?(:pointsales, :img_pointsale)
+  	 add_column :pointsales, :img_pointsale, :string
+    end
   end
 end

+ 88 - 92
db/schema.rb

@@ -55,34 +55,27 @@ ActiveRecord::Schema.define(version: 20161214181936) do
   add_index "available_products", ["product_id"], name: "index_available_products_on_product_id", using: :btree
 
   create_table "billing_informations", force: :cascade do |t|
-    t.integer  "customer_id",                           default: 0,  null: false
-    t.string   "name",        limit: 255,               default: "", null: false
-    t.string   "rfc",         limit: 13,                default: "", null: false
-    t.string   "address",     limit: 255,               default: "", null: false
-    t.integer  "zipcode",                               default: 0,  null: false
-    t.string   "num_ext",                               default: "", null: false
-    t.string   "num_int",                               default: "", null: false
-    t.integer  "state_id",                              default: 0,  null: false
-    t.integer  "county_id",                             default: 0,  null: false
-    t.string   "city",                                  default: "", null: false
-    t.string   "suburb",                                default: "", null: false
-    t.integer  "status",                                default: 1,  null: false
-    t.datetime "created_at",              precision: 6,              null: false
-    t.datetime "updated_at",              precision: 6,              null: false
-    t.integer  "supplier_id",                           default: 0,  null: false
+    t.integer  "customer_id",             default: 0,  null: false
+    t.string   "name",        limit: 255, default: "", null: false
+    t.string   "rfc",         limit: 13,  default: "", null: false
+    t.string   "address",     limit: 255, default: "", null: false
+    t.integer  "zipcode",                 default: 0,  null: false
+    t.string   "num_ext",                 default: "", null: false
+    t.string   "num_int",                 default: "", null: false
+    t.integer  "state_id",                default: 0,  null: false
+    t.integer  "county_id",               default: 0,  null: false
+    t.string   "city",                    default: "", null: false
+    t.string   "suburb",                  default: "", null: false
+    t.integer  "status",                  default: 1,  null: false
+    t.datetime "created_at",                           null: false
+    t.datetime "updated_at",                           null: false
+    t.integer  "supplier_id",             default: 0,  null: false
   end
 
   add_index "billing_informations", ["county_id"], name: "index_billing_informations_on_county_id", using: :btree
   add_index "billing_informations", ["customer_id"], name: "index_billing_informations_on_customer_id", using: :btree
   add_index "billing_informations", ["state_id"], name: "index_billing_informations_on_state_id", using: :btree
 
-  create_table "brands", force: :cascade do |t|
-    t.string   "name",                   null: false
-    t.integer  "status",     default: 1, null: false
-    t.datetime "created_at",             null: false
-    t.datetime "updated_at",             null: false
-  end
-
   create_table "cash_out_details", force: :cascade do |t|
     t.integer  "cash_out_id"
     t.integer  "payment_method_id"
@@ -119,10 +112,10 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.string   "name"
     t.text     "description"
     t.integer  "pointsale_id"
-    t.datetime "created_at",   precision: 6,             null: false
-    t.datetime "updated_at",   precision: 6,             null: false
-    t.integer  "main",                       default: 0, null: false
-    t.integer  "status",                     default: 1, null: false
+    t.datetime "created_at",               null: false
+    t.datetime "updated_at",               null: false
+    t.integer  "main",         default: 0, null: false
+    t.integer  "status",       default: 1, null: false
   end
 
   create_table "cash_registers_moves", force: :cascade do |t|
@@ -130,8 +123,8 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.integer  "payment_method_id"
     t.decimal  "quantity",                                                 default: 0.0, null: false
     t.string   "move_type",             limit: 1,                                        null: false
-    t.datetime "created_at",                      precision: 6,                          null: false
-    t.datetime "updated_at",                      precision: 6,                          null: false
+    t.datetime "created_at",                                                             null: false
+    t.datetime "updated_at",                                                             null: false
     t.integer  "sale_id"
     t.integer  "cardnumber"
     t.integer  "purchase_id"
@@ -151,10 +144,10 @@ ActiveRecord::Schema.define(version: 20161214181936) do
   create_table "categories", force: :cascade do |t|
     t.string   "category"
     t.text     "description"
-    t.integer  "status",                    default: 1
-    t.datetime "created_at",  precision: 6,             null: false
-    t.datetime "updated_at",  precision: 6,             null: false
-    t.integer  "parent_id",                 default: 0, null: false
+    t.integer  "status",      default: 1
+    t.datetime "created_at",              null: false
+    t.datetime "updated_at",              null: false
+    t.integer  "parent_id",   default: 0, null: false
   end
 
   create_table "categories_products", id: false, force: :cascade do |t|
@@ -178,18 +171,19 @@ ActiveRecord::Schema.define(version: 20161214181936) do
   add_index "commissions", ["pointsale_id"], name: "index_commissions_on_pointsale_id", using: :btree
 
   create_table "contacts", force: :cascade do |t|
-    t.string   "name",       limit: 255,               default: "", null: false
-    t.string   "last_name",  limit: 255,               default: "", null: false
-    t.string   "phone",      limit: 30,                default: "", null: false
-    t.string   "email",      limit: 255,               default: "", null: false
-    t.text     "notes",                                default: "", null: false
-    t.integer  "status",                               default: 1,  null: false
-    t.datetime "created_at",             precision: 6,              null: false
-    t.datetime "updated_at",             precision: 6,              null: false
+    t.string   "name",       limit: 255, default: "", null: false
+    t.string   "last_name",  limit: 255, default: "", null: false
+    t.string   "phone",      limit: 30,  default: "", null: false
+    t.string   "email",      limit: 255, default: "", null: false
+    t.text     "notes",                  default: "", null: false
+    t.integer  "status",                 default: 1,  null: false
+    t.datetime "created_at",                          null: false
+    t.datetime "updated_at",                          null: false
   end
 
   create_table "credit_payments", force: :cascade do |t|
     t.integer  "customer_id"
+    t.integer  "credit_id"
     t.integer  "pointsale_id"
     t.decimal  "quantity",     precision: 10, scale: 2, default: 0.0, null: false
     t.integer  "status",                                default: 0,   null: false
@@ -197,9 +191,9 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.datetime "created_at",                                          null: false
     t.datetime "updated_at",                                          null: false
     t.integer  "user_id"
-    t.integer  "credit_id"
   end
 
+  add_index "credit_payments", ["credit_id"], name: "index_credit_payments_on_credit_id", using: :btree
   add_index "credit_payments", ["customer_id"], name: "index_credit_payments_on_customer_id", using: :btree
   add_index "credit_payments", ["pointsale_id"], name: "index_credit_payments_on_pointsale_id", using: :btree
 
@@ -228,8 +222,8 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.integer  "time_limit",                                        default: 0,    null: false
     t.text     "notes",                                             default: "",   null: false
     t.integer  "status",                                            default: 1,    null: false
-    t.datetime "created_at",               precision: 6,                           null: false
-    t.datetime "updated_at",               precision: 6,                           null: false
+    t.datetime "created_at",                                                       null: false
+    t.datetime "updated_at",                                                       null: false
     t.integer  "contact_id"
     t.integer  "is_public",                                         default: 0
   end
@@ -237,10 +231,10 @@ ActiveRecord::Schema.define(version: 20161214181936) do
   create_table "expenses", force: :cascade do |t|
     t.integer  "expensesconcept_id"
     t.integer  "open_cash_register_id"
-    t.decimal  "quantity",                            default: 0.0, null: false
-    t.integer  "status",                              default: 1,   null: false
-    t.datetime "created_at",            precision: 6,               null: false
-    t.datetime "updated_at",            precision: 6,               null: false
+    t.decimal  "quantity",              default: 0.0, null: false
+    t.integer  "status",                default: 1,   null: false
+    t.datetime "created_at",                          null: false
+    t.datetime "updated_at",                          null: false
     t.text     "observations"
     t.date     "expense_date"
     t.string   "expense_code"
@@ -253,10 +247,10 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.string   "name"
     t.string   "description"
     t.boolean  "allpoints"
-    t.integer  "status",                              default: 1
-    t.datetime "created_at",            precision: 6,             null: false
-    t.datetime "updated_at",            precision: 6,             null: false
-    t.integer  "expense_from_purchase",               default: 0, null: false
+    t.integer  "status",                default: 1
+    t.datetime "created_at",                        null: false
+    t.datetime "updated_at",                        null: false
+    t.integer  "expense_from_purchase", default: 0, null: false
   end
 
   create_table "expensesconcepts_pointsales", id: false, force: :cascade do |t|
@@ -269,8 +263,8 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.integer  "user_id"
     t.date     "inventory_date"
     t.text     "notes"
-    t.datetime "created_at",     precision: 6, null: false
-    t.datetime "updated_at",     precision: 6, null: false
+    t.datetime "created_at",     null: false
+    t.datetime "updated_at",     null: false
   end
 
   add_index "inventories", ["pointsale_id"], name: "index_inventories_on_pointsale_id", using: :btree
@@ -281,10 +275,10 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.integer  "product_id"
     t.integer  "purchase_id"
     t.integer  "sale_id"
-    t.decimal  "quantity",                             default: 0.0, null: false
-    t.string   "move_type",    limit: 1,                             null: false
-    t.datetime "created_at",             precision: 6,               null: false
-    t.datetime "updated_at",             precision: 6,               null: false
+    t.decimal  "quantity",               default: 0.0, null: false
+    t.string   "move_type",    limit: 1,               null: false
+    t.datetime "created_at",                           null: false
+    t.datetime "updated_at",                           null: false
     t.integer  "reason"
     t.integer  "transfer_id"
   end
@@ -300,29 +294,29 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.decimal  "initial_cash",     precision: 10, scale: 2, default: 0.0
     t.decimal  "final_cash",       precision: 10, scale: 2, default: 0.0
     t.integer  "status",                                    default: 0
-    t.datetime "created_at",       precision: 6,                          null: false
-    t.datetime "updated_at",       precision: 6,                          null: false
+    t.datetime "created_at",                                              null: false
+    t.datetime "updated_at",                                              null: false
   end
 
   add_index "open_cash_registers", ["cash_register_id"], name: "index_open_cash_registers_on_cash_register_id", using: :btree
   add_index "open_cash_registers", ["user_id"], name: "index_open_cash_registers_on_user_id", using: :btree
 
   create_table "payment_methods", force: :cascade do |t|
-    t.string   "method",                               null: false
-    t.integer  "status",                   default: 1, null: false
-    t.datetime "created_at", precision: 6,             null: false
-    t.datetime "updated_at", precision: 6,             null: false
+    t.string   "method",                 null: false
+    t.integer  "status",     default: 1, null: false
+    t.datetime "created_at",             null: false
+    t.datetime "updated_at",             null: false
     t.integer  "reference"
-    t.integer  "isCash",                   default: 0, null: false
+    t.integer  "isCash",     default: 0, null: false
   end
 
   create_table "pointsales", force: :cascade do |t|
     t.string   "name"
     t.string   "address"
     t.text     "notes"
-    t.integer  "status",                                   default: 1
-    t.datetime "created_at",                 precision: 6,             null: false
-    t.datetime "updated_at",                 precision: 6,             null: false
+    t.integer  "status",                     default: 1
+    t.datetime "created_at",                             null: false
+    t.datetime "updated_at",                             null: false
     t.text     "prefix"
     t.string   "img_pointsale_file_name"
     t.string   "img_pointsale_content_type"
@@ -430,13 +424,13 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.string   "img_product_file_name"
     t.string   "img_product_content_type"
     t.integer  "img_product_file_size"
-    t.datetime "img_product_updated_at",               precision: 6
+    t.datetime "img_product_updated_at"
     t.boolean  "presentation",                                                  default: false, null: false
     t.boolean  "inventory",                                                     default: true,  null: false
     t.decimal  "content"
     t.integer  "status",                                                        default: 1,     null: false
-    t.datetime "created_at",                           precision: 6,                            null: false
-    t.datetime "updated_at",                           precision: 6,                            null: false
+    t.datetime "created_at",                                                                    null: false
+    t.datetime "updated_at",                                                                    null: false
     t.integer  "unit_id"
     t.integer  "include_purchase_tax",                                          default: 0,     null: false
     t.integer  "include_sale_tax",                                              default: 0,     null: false
@@ -446,7 +440,6 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.boolean  "is_parent",                                                     default: false
     t.boolean  "is_in_dollars",                                                 default: false
     t.decimal  "price_base_dollars",                   precision: 10, scale: 2
-    t.integer  "brand_id"
     t.string   "img_product"
   end
 
@@ -511,14 +504,17 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.integer  "purchase_id"
     t.integer  "product_id"
     t.integer  "quantity"
-    t.decimal  "price",       precision: 10, scale: 2, default: 0.0
-    t.decimal  "amount",      precision: 10, scale: 2, default: 0.0
-    t.datetime "created_at",  precision: 6,                          null: false
-    t.datetime "updated_at",  precision: 6,                          null: false
+    t.decimal  "price",       precision: 10, scale: 2, default: 0.0, null: false
+    t.decimal  "amount",      precision: 10, scale: 2, default: 0.0, null: false
+    t.datetime "created_at",                                         null: false
+    t.datetime "updated_at",                                         null: false
     t.integer  "status",                               default: 1,   null: false
     t.decimal  "tax",                                                null: false
   end
 
+  add_index "purchase_details", ["product_id"], name: "index_purchase_details_on_product_id", using: :btree
+  add_index "purchase_details", ["purchase_id"], name: "index_purchase_details_on_purchase_id", using: :btree
+
   create_table "purchases", force: :cascade do |t|
     t.integer  "supplier_id"
     t.integer  "pointsale_id"
@@ -528,10 +524,10 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.decimal  "total",         precision: 10, scale: 2, default: 0.0
     t.text     "observations"
     t.date     "purchase_date"
-    t.integer  "user_id"
-    t.datetime "created_at",    precision: 6,                            null: false
-    t.datetime "updated_at",    precision: 6,                            null: false
-    t.integer  "status",                                 default: 1,     null: false
+    t.string   "user_id"
+    t.datetime "created_at",                                             null: false
+    t.datetime "updated_at",                                             null: false
+    t.integer  "status",                                 default: 0,     null: false
     t.integer  "warehouse_id"
     t.boolean  "is_in_dollars",                          default: false
     t.decimal  "exchange",      precision: 10, scale: 2
@@ -547,8 +543,8 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.decimal  "total",                           precision: 10, scale: 2, default: 0.0, null: false
     t.integer  "status",                                                   default: 1,   null: false
     t.date     "date_sale",                                                              null: false
-    t.datetime "created_at",                      precision: 6,                          null: false
-    t.datetime "updated_at",                      precision: 6,                          null: false
+    t.datetime "created_at",                                                             null: false
+    t.datetime "updated_at",                                                             null: false
     t.integer  "saletype",              limit: 2
     t.integer  "seller_id"
     t.string   "sale_code"
@@ -569,8 +565,8 @@ ActiveRecord::Schema.define(version: 20161214181936) do
     t.decimal  "discount",         precision: 10, scale: 2, default: 0.0, null: false
     t.decimal  "total",            precision: 10, scale: 2, default: 0.0, null: false
     t.integer  "status",                                    default: 1,   null: false
-    t.datetime "created_at",       precision: 6,                          null: false
-    t.datetime "updated_at",       precision: 6,                          null: false
+    t.datetime "created_at",                                              null: false
+    t.datetime "updated_at",                                              null: false
     t.integer  "special_price_id"
     t.decimal  "unit_price",       precision: 10, scale: 2
   end
@@ -655,14 +651,14 @@ ActiveRecord::Schema.define(version: 20161214181936) do
   add_index "storers", ["warehouse_id"], name: "index_storers_on_warehouse_id", using: :btree
 
   create_table "suppliers", force: :cascade do |t|
-    t.string   "nick_name",  limit: 255,               default: "", null: false
-    t.string   "phone",      limit: 30,                default: "", null: false
-    t.string   "email",      limit: 255,               default: "", null: false
-    t.text     "notes",                                default: "", null: false
+    t.string   "nick_name",  limit: 255, default: "", null: false
+    t.string   "phone",      limit: 30,  default: "", null: false
+    t.string   "email",      limit: 255, default: "", null: false
+    t.text     "notes",                  default: "", null: false
     t.integer  "contact_id"
-    t.integer  "status",                               default: 1,  null: false
-    t.datetime "created_at",             precision: 6,              null: false
-    t.datetime "updated_at",             precision: 6,              null: false
+    t.integer  "status",                 default: 1,  null: false
+    t.datetime "created_at",                          null: false
+    t.datetime "updated_at",                          null: false
   end
 
   add_index "suppliers", ["contact_id"], name: "index_suppliers_on_contact_id", using: :btree
@@ -725,8 +721,8 @@ ActiveRecord::Schema.define(version: 20161214181936) do
   create_table "units", force: :cascade do |t|
     t.string   "unit"
     t.integer  "status"
-    t.datetime "created_at", precision: 6, null: false
-    t.datetime "updated_at", precision: 6, null: false
+    t.datetime "created_at", null: false
+    t.datetime "updated_at", null: false
   end
 
   create_table "users", force: :cascade do |t|

BIN
erd.pdf