Introduced StockChange. Implemented first part of stockit-logic with updating article's quantity.

This commit is contained in:
Benjamin Meichsner 2009-01-16 02:17:49 +01:00
parent 7ff0467b16
commit b38025869a
27 changed files with 233 additions and 123 deletions

View file

@ -0,0 +1,17 @@
class CreateStockChanges < ActiveRecord::Migration
def self.up
create_table :stock_changes do |t|
t.references :delivery
t.references :order
t.references :article
t.decimal :quantity, :precision => 6, :scale => 2, :default => 0.0
t.datetime :created_at
end
add_column :articles, :quantity, :decimal, :precision => 6, :scale => 2, :default => 0.0
end
def self.down
drop_table :stock_changes
end
end

View file

@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20090114101610) do
ActiveRecord::Schema.define(:version => 20090115232435) do
create_table "article_categories", :force => true do |t|
t.string "name", :default => "", :null => false
@ -36,6 +36,7 @@ ActiveRecord::Schema.define(:version => 20090114101610) do
t.string "order_number"
t.datetime "created_at"
t.datetime "updated_at"
t.decimal "quantity", :precision => 6, :scale => 2, :default => 0.0
end
add_index "articles", ["name", "supplier_id"], :name => "index_articles_on_name_and_supplier_id"
@ -184,7 +185,7 @@ ActiveRecord::Schema.define(:version => 20090114101610) do
create_table "messages", :force => true do |t|
t.integer "sender_id"
t.text "recipients_ids", :null => false
t.text "recipients_ids"
t.string "subject", :null => false
t.text "body"
t.integer "email_state", :default => 0, :null => false
@ -241,6 +242,14 @@ ActiveRecord::Schema.define(:version => 20090114101610) do
add_index "orders", ["finished"], :name => "index_orders_on_finished"
add_index "orders", ["starts"], :name => "index_orders_on_starts"
create_table "stock_changes", :force => true do |t|
t.integer "delivery_id"
t.integer "order_id"
t.integer "article_id"
t.decimal "quantity", :precision => 6, :scale => 2, :default => 0.0
t.datetime "created_at"
end
create_table "suppliers", :force => true do |t|
t.string "name", :default => "", :null => false
t.string "address", :default => "", :null => false