Moved User.address-info into Ordergroup.contact_... attributes. Updated model-fixtures for testing.
This commit is contained in:
parent
aa47a24fda
commit
0a2a79237a
60 changed files with 466 additions and 443 deletions
|
|
@ -2,12 +2,28 @@ class RefactorOrderLogic < ActiveRecord::Migration
|
|||
def self.up
|
||||
# TODO: Combine migrations since foodsoft3-development into one file
|
||||
# and try to build a migration path from old data.
|
||||
|
||||
# # articles
|
||||
|
||||
# == Ordergroups
|
||||
add_column :groups, :deleted_at, :datetime # acts_as_paranoid
|
||||
remove_column :groups, :actual_size # Useless, desposits are better stored within a transaction.note
|
||||
# move contact-infos from users to ordergroups
|
||||
add_column :groups, :contact_person, :string
|
||||
add_column :groups, :contact_phone, :string
|
||||
add_column :groups, :contact_address, :string
|
||||
Ordergroup.all.each do |ordergroup|
|
||||
contact = ordergroup.users.first
|
||||
if contact
|
||||
ordergroup.update_attributes :contact_person => contact.name,
|
||||
:contact_phone => contact.phone, :contact_address => contact.address
|
||||
end
|
||||
end
|
||||
remove_column :users, :address
|
||||
#
|
||||
# # == Article
|
||||
# rename_column :articles, :net_price, :price
|
||||
# remove_column :articles, :gross_price
|
||||
#
|
||||
# # orders
|
||||
# # == Order
|
||||
# drop_table :orders
|
||||
# drop_table :group_order_results
|
||||
# drop_table :order_article_results
|
||||
|
|
@ -24,12 +40,12 @@ class RefactorOrderLogic < ActiveRecord::Migration
|
|||
# t.integer :updated_by_user_id
|
||||
# end
|
||||
#
|
||||
# # invoices
|
||||
# # == Invoice
|
||||
# add_column :invoices, :order_id, :integer
|
||||
# add_column :invoices, :deposit, :decimal, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
||||
# add_column :invoices, :deposit_credit, :decimal, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
||||
#
|
||||
# # comments
|
||||
# # == Comment
|
||||
# drop_table :comments
|
||||
# create_table :order_comments do |t|
|
||||
# t.references :order
|
||||
|
|
@ -38,7 +54,7 @@ class RefactorOrderLogic < ActiveRecord::Migration
|
|||
# t.datetime :created_at
|
||||
# end
|
||||
#
|
||||
# # article_prices
|
||||
# # == ArticlePrice
|
||||
# create_table :article_prices do |t|
|
||||
# t.references :article
|
||||
# t.decimal :price, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
||||
|
|
@ -59,11 +75,8 @@ class RefactorOrderLogic < ActiveRecord::Migration
|
|||
# # order-articles
|
||||
# add_column :order_articles, :article_price_id, :integer
|
||||
#
|
||||
# # ordergroups
|
||||
# add_column :groups, :deleted_at, :datetime
|
||||
|
||||
# GroupOrders
|
||||
change_column :group_orders, :updated_by_user_id, :integer, :default => nil, :null => true
|
||||
# # == GroupOrder
|
||||
# change_column :group_orders, :updated_by_user_id, :integer, :default => nil, :null => true
|
||||
end
|
||||
|
||||
def self.down
|
||||
|
|
|
|||
47
db/schema.rb
47
db/schema.rb
|
|
@ -9,7 +9,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20090119155930) do
|
||||
ActiveRecord::Schema.define(:version => 20090120184410) do
|
||||
|
||||
create_table "article_categories", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
|
|
@ -28,23 +28,23 @@ ActiveRecord::Schema.define(:version => 20090119155930) do
|
|||
end
|
||||
|
||||
create_table "articles", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
t.integer "supplier_id", :default => 0, :null => false
|
||||
t.integer "article_category_id", :default => 0, :null => false
|
||||
t.string "unit", :default => "", :null => false
|
||||
t.string "name", :default => "", :null => false
|
||||
t.integer "supplier_id", :default => 0, :null => false
|
||||
t.integer "article_category_id", :default => 0, :null => false
|
||||
t.string "unit", :default => "", :null => false
|
||||
t.string "note"
|
||||
t.boolean "availability", :default => true, :null => false
|
||||
t.boolean "availability", :default => true, :null => false
|
||||
t.string "manufacturer"
|
||||
t.string "origin"
|
||||
t.datetime "shared_updated_on"
|
||||
t.decimal "price", :precision => 8, :scale => 2
|
||||
t.decimal "price"
|
||||
t.float "tax"
|
||||
t.decimal "deposit", :precision => 8, :scale => 2, :default => 0.0
|
||||
t.integer "unit_quantity", :default => 1, :null => false
|
||||
t.decimal "deposit", :default => 0.0
|
||||
t.integer "unit_quantity", :default => 1, :null => false
|
||||
t.string "order_number"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.decimal "quantity", :precision => 6, :scale => 2, :default => 0.0
|
||||
t.decimal "quantity", :default => 0.0
|
||||
t.datetime "deleted_at"
|
||||
end
|
||||
|
||||
|
|
@ -113,24 +113,26 @@ ActiveRecord::Schema.define(:version => 20090119155930) do
|
|||
add_index "group_orders", ["ordergroup_id", "order_id"], :name => "index_group_orders_on_ordergroup_id_and_order_id", :unique => true
|
||||
|
||||
create_table "groups", :force => true do |t|
|
||||
t.string "type", :default => "", :null => false
|
||||
t.string "name", :default => "", :null => false
|
||||
t.string "type", :default => "", :null => false
|
||||
t.string "name", :default => "", :null => false
|
||||
t.string "description"
|
||||
t.integer "actual_size"
|
||||
t.decimal "account_balance", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
||||
t.decimal "account_balance", :default => 0.0, :null => false
|
||||
t.datetime "account_updated"
|
||||
t.datetime "created_on", :null => false
|
||||
t.boolean "role_admin", :default => false, :null => false
|
||||
t.boolean "role_suppliers", :default => false, :null => false
|
||||
t.boolean "role_article_meta", :default => false, :null => false
|
||||
t.boolean "role_finance", :default => false, :null => false
|
||||
t.boolean "role_orders", :default => false, :null => false
|
||||
t.boolean "weekly_task", :default => false
|
||||
t.datetime "created_on", :null => false
|
||||
t.boolean "role_admin", :default => false, :null => false
|
||||
t.boolean "role_suppliers", :default => false, :null => false
|
||||
t.boolean "role_article_meta", :default => false, :null => false
|
||||
t.boolean "role_finance", :default => false, :null => false
|
||||
t.boolean "role_orders", :default => false, :null => false
|
||||
t.boolean "weekly_task", :default => false
|
||||
t.integer "weekday"
|
||||
t.string "task_name"
|
||||
t.string "task_description"
|
||||
t.integer "task_required_users", :default => 1
|
||||
t.integer "task_required_users", :default => 1
|
||||
t.datetime "deleted_at"
|
||||
t.string "contact_person"
|
||||
t.string "contact_phone"
|
||||
t.string "contact_address"
|
||||
end
|
||||
|
||||
add_index "groups", ["name"], :name => "index_groups_on_name", :unique => true
|
||||
|
|
@ -257,7 +259,6 @@ ActiveRecord::Schema.define(:version => 20090119155930) do
|
|||
t.string "last_name", :default => "", :null => false
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "phone"
|
||||
t.string "address"
|
||||
t.datetime "created_on", :null => false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_expires"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue