New annotation, because of db switch to mysql.

Background: sqlite has some problems with decimal option.
This commit is contained in:
benni 2011-05-07 21:55:24 +02:00
parent c2496aa4fd
commit 46450cebef
60 changed files with 623 additions and 568 deletions

View file

@ -1,12 +1,3 @@
# == Schema Information
#
# Table name: article_categories
#
# id :integer not null, primary key
# name :string(255) default(""), not null
# description :string(255)
#
class ArticleCategory < ActiveRecord::Base
has_many :articles
@ -14,3 +5,13 @@ class ArticleCategory < ActiveRecord::Base
validates_uniqueness_of :name
end
# == Schema Information
#
# Table name: article_categories
#
# id :integer(4) not null, primary key
# name :string(255) default(""), not null
# description :string(255)
#

View file

@ -1,16 +1,3 @@
# == Schema Information
#
# Table name: article_prices
#
# id :integer not null, primary key
# article_id :integer
# price :decimal(8, 2) default(0.0), not null
# tax :decimal(8, 2) default(0.0), not null
# deposit :decimal(8, 2) default(0.0), not null
# unit_quantity :integer
# created_at :datetime
#
class ArticlePrice < ActiveRecord::Base
belongs_to :article
@ -43,3 +30,17 @@ class ArticlePrice < ActiveRecord::Base
(gross_price * (Foodsoft.config[:price_markup] / 100 + 1)).round(2)
end
end
# == Schema Information
#
# Table name: article_prices
#
# id :integer(4) not null, primary key
# article_id :integer(4)
# price :decimal(8, 2) default(0.0), not null
# tax :decimal(8, 2) default(0.0), not null
# deposit :decimal(8, 2) default(0.0), not null
# unit_quantity :integer(4)
# created_at :datetime
#

View file

@ -14,13 +14,14 @@ class Assignment < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: assignments
#
# id :integer not null, primary key
# user_id :integer default(0), not null
# task_id :integer default(0), not null
# accepted :boolean default(FALSE)
# id :integer(4) not null, primary key
# user_id :integer(4) default(0), not null
# task_id :integer(4) default(0), not null
# accepted :boolean(1) default(FALSE)
#

View file

@ -18,12 +18,13 @@ class Delivery < ActiveRecord::Base
end
# == Schema Information
#
# Table name: deliveries
#
# id :integer not null, primary key
# supplier_id :integer
# id :integer(4) not null, primary key
# supplier_id :integer(4)
# delivered_on :date
# created_at :datetime
# note :text

View file

@ -1,15 +1,3 @@
# == Schema Information
#
# Table name: financial_transactions
#
# id :integer not null, primary key
# ordergroup_id :integer default(0), not null
# amount :decimal(8, 2) default(0.0), not null
# note :text not null
# user_id :integer default(0), not null
# created_on :datetime not null
#
# financial transactions are the foodcoop internal financial transactions
# only ordergroups have an account balance and are happy to transfer money
class FinancialTransaction < ActiveRecord::Base
@ -25,3 +13,16 @@ class FinancialTransaction < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: financial_transactions
#
# id :integer(4) not null, primary key
# ordergroup_id :integer(4) default(0), not null
# amount :decimal(8, 2) default(0.0), not null
# note :text default(""), not null
# user_id :integer(4) default(0), not null
# created_on :datetime not null
#

View file

@ -41,32 +41,33 @@ class Group < ActiveRecord::Base
end
# == Schema Information
#
# Table name: groups
#
# id :integer not null, primary key
# id :integer(4) not null, primary key
# type :string(255) default(""), not null
# name :string(255) default(""), not null
# description :string(255)
# account_balance :decimal(, ) default(0.0), not null
# account_balance :decimal(8, 2) default(0.0), not null
# account_updated :datetime
# created_on :datetime not null
# role_admin :boolean default(FALSE), not null
# role_suppliers :boolean default(FALSE), not null
# role_article_meta :boolean default(FALSE), not null
# role_finance :boolean default(FALSE), not null
# role_orders :boolean default(FALSE), not null
# weekly_task :boolean default(FALSE)
# weekday :integer
# role_admin :boolean(1) default(FALSE), not null
# role_suppliers :boolean(1) default(FALSE), not null
# role_article_meta :boolean(1) default(FALSE), not null
# role_finance :boolean(1) default(FALSE), not null
# role_orders :boolean(1) default(FALSE), not null
# weekly_task :boolean(1) default(FALSE)
# weekday :integer(4)
# task_name :string(255)
# task_description :string(255)
# task_required_users :integer default(1)
# task_required_users :integer(4) default(1)
# deleted_at :datetime
# contact_person :string(255)
# contact_phone :string(255)
# contact_address :string(255)
# stats :text
# task_duration :integer default(1)
# task_duration :integer(4) default(1)
#

View file

@ -1,16 +1,3 @@
# == Schema Information
#
# Table name: group_orders
#
# id :integer not null, primary key
# ordergroup_id :integer default(0), not null
# order_id :integer default(0), not null
# price :decimal(8, 2) default(0.0), not null
# lock_version :integer default(0), not null
# updated_on :datetime not null
# updated_by_user_id :integer
#
# A GroupOrder represents an Order placed by an Ordergroup.
class GroupOrder < ActiveRecord::Base
@ -49,3 +36,17 @@ class GroupOrder < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: group_orders
#
# id :integer(4) not null, primary key
# ordergroup_id :integer(4) default(0), not null
# order_id :integer(4) default(0), not null
# price :decimal(8, 2) default(0.0), not null
# lock_version :integer(4) default(0), not null
# updated_on :datetime not null
# updated_by_user_id :integer(4)
#

View file

@ -159,15 +159,16 @@ class GroupOrderArticle < ActiveRecord::Base
end
# == Schema Information
#
# Table name: group_order_articles
#
# id :integer not null, primary key
# group_order_id :integer default(0), not null
# order_article_id :integer default(0), not null
# quantity :integer default(0), not null
# tolerance :integer default(0), not null
# id :integer(4) not null, primary key
# group_order_id :integer(4) default(0), not null
# order_article_id :integer(4) default(0), not null
# quantity :integer(4) default(0), not null
# tolerance :integer(4) default(0), not null
# updated_on :datetime not null
# result :decimal(8, 3)
#

View file

@ -1,14 +1,3 @@
# == Schema Information
#
# Table name: group_order_article_quantities
#
# id :integer not null, primary key
# group_order_article_id :integer default(0), not null
# quantity :integer default(0)
# tolerance :integer default(0)
# created_on :datetime not null
#
# stores the quantity, tolerance and timestamp of an GroupOrderArticle
# Considers every update of an article-order, so may rows for one group_order_article ar possible.
@ -21,3 +10,15 @@ class GroupOrderArticleQuantity < ActiveRecord::Base
validates_inclusion_of :tolerance, :in => 0..99
end
# == Schema Information
#
# Table name: group_order_article_quantities
#
# id :integer(4) not null, primary key
# group_order_article_id :integer(4) default(0), not null
# quantity :integer(4) default(0)
# tolerance :integer(4) default(0)
# created_on :datetime not null
#

View file

@ -1,15 +1,3 @@
# == Schema Information
#
# Table name: invites
#
# id :integer not null, primary key
# token :string(255) default(""), not null
# expires_at :datetime not null
# group_id :integer default(0), not null
# user_id :integer default(0), not null
# email :string(255) default(""), not null
#
require 'digest/sha1'
# Invites are created by foodcoop users to invite a new user into the foodcoop and their order group.
@ -46,3 +34,16 @@ class Invite < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: invites
#
# id :integer(4) not null, primary key
# token :string(255) default(""), not null
# expires_at :datetime not null
# group_id :integer(4) default(0), not null
# user_id :integer(4) default(0), not null
# email :string(255) default(""), not null
#

View file

@ -29,14 +29,15 @@ class Invoice < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: invoices
#
# id :integer not null, primary key
# supplier_id :integer
# delivery_id :integer
# order_id :integer
# id :integer(4) not null, primary key
# supplier_id :integer(4)
# delivery_id :integer(4)
# order_id :integer(4)
# number :string(255)
# date :date
# paid_on :date

View file

@ -1,12 +1,3 @@
# == Schema Information
#
# Table name: memberships
#
# id :integer not null, primary key
# group_id :integer default(0), not null
# user_id :integer default(0), not null
#
class Membership < ActiveRecord::Base
belongs_to :user
@ -20,3 +11,13 @@ class Membership < ActiveRecord::Base
raise ERR_NO_ADMIN_MEMBER_DELETE if self.group.role_admin? && self.group.memberships.size == 1 && Group.find_all_by_role_admin(true).size == 1
end
end
# == Schema Information
#
# Table name: memberships
#
# id :integer(4) not null, primary key
# group_id :integer(4) default(0), not null
# user_id :integer(4) default(0), not null
#

View file

@ -76,17 +76,18 @@ class Message < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: messages
#
# id :integer not null, primary key
# sender_id :integer
# id :integer(4) not null, primary key
# sender_id :integer(4)
# recipients_ids :text
# subject :string(255) not null
# body :text
# email_state :integer default(0), not null
# private :boolean default(FALSE)
# email_state :integer(4) default(0), not null
# private :boolean(1) default(FALSE)
# created_at :datetime
#

View file

@ -1,18 +1,3 @@
# == Schema Information
#
# Table name: orders
#
# id :integer not null, primary key
# supplier_id :integer
# note :text
# starts :datetime
# ends :datetime
# state :string(255) default("open")
# lock_version :integer default(0), not null
# updated_by_user_id :integer
# foodcoop_result :decimal(8, 2)
#
class Order < ActiveRecord::Base
extend ActiveSupport::Memoizable # Ability to cache method results. Use memoize :expensive_method
acts_as_ordered :order => "ends" # easyier find of next or previous model
@ -226,3 +211,19 @@ class Order < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: orders
#
# id :integer(4) not null, primary key
# supplier_id :integer(4)
# note :text
# starts :datetime
# ends :datetime
# state :string(255) default("open")
# lock_version :integer(4) default(0), not null
# updated_by_user_id :integer(4)
# foodcoop_result :decimal(8, 2)
#

View file

@ -1,17 +1,3 @@
# == Schema Information
#
# Table name: order_articles
#
# id :integer not null, primary key
# order_id :integer default(0), not null
# article_id :integer default(0), not null
# quantity :integer default(0), not null
# tolerance :integer default(0), not null
# units_to_order :integer default(0), not null
# lock_version :integer default(0), not null
# article_price_id :integer
#
# An OrderArticle represents a single Article that is part of an Order.
class OrderArticle < ActiveRecord::Base
@ -120,3 +106,18 @@ class OrderArticle < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: order_articles
#
# id :integer(4) not null, primary key
# order_id :integer(4) default(0), not null
# article_id :integer(4) default(0), not null
# quantity :integer(4) default(0), not null
# tolerance :integer(4) default(0), not null
# units_to_order :integer(4) default(0), not null
# lock_version :integer(4) default(0), not null
# article_price_id :integer(4)
#

View file

@ -1,14 +1,3 @@
# == Schema Information
#
# Table name: order_comments
#
# id :integer not null, primary key
# order_id :integer
# user_id :integer
# text :text
# created_at :datetime
#
class OrderComment < ActiveRecord::Base
belongs_to :order
@ -16,3 +5,15 @@ class OrderComment < ActiveRecord::Base
validates_presence_of :order_id, :user_id, :text
end
# == Schema Information
#
# Table name: order_comments
#
# id :integer(4) not null, primary key
# order_id :integer(4)
# user_id :integer(4)
# text :text
# created_at :datetime
#

View file

@ -87,28 +87,28 @@ end
#
# Table name: groups
#
# id :integer not null, primary key
# id :integer(4) not null, primary key
# type :string(255) default(""), not null
# name :string(255) default(""), not null
# description :string(255)
# account_balance :decimal(, ) default(0.0), not null
# account_balance :decimal(8, 2) default(0.0), not null
# account_updated :datetime
# created_on :datetime not null
# role_admin :boolean default(FALSE), not null
# role_suppliers :boolean default(FALSE), not null
# role_article_meta :boolean default(FALSE), not null
# role_finance :boolean default(FALSE), not null
# role_orders :boolean default(FALSE), not null
# weekly_task :boolean default(FALSE)
# weekday :integer
# role_admin :boolean(1) default(FALSE), not null
# role_suppliers :boolean(1) default(FALSE), not null
# role_article_meta :boolean(1) default(FALSE), not null
# role_finance :boolean(1) default(FALSE), not null
# role_orders :boolean(1) default(FALSE), not null
# weekly_task :boolean(1) default(FALSE)
# weekday :integer(4)
# task_name :string(255)
# task_description :string(255)
# task_required_users :integer default(1)
# task_required_users :integer(4) default(1)
# deleted_at :datetime
# contact_person :string(255)
# contact_phone :string(255)
# contact_address :string(255)
# stats :text
# task_duration :integer default(1)
# task_duration :integer(4) default(1)
#

View file

@ -56,14 +56,14 @@ end
#
# Table name: pages
#
# id :integer not null, primary key
# id :integer(4) not null, primary key
# title :string(255)
# body :text
# permalink :string(255)
# lock_version :integer default(0)
# updated_by :integer
# redirect :integer
# parent_id :integer
# lock_version :integer(4) default(0)
# updated_by :integer(4)
# redirect :integer(4)
# parent_id :integer(4)
# created_at :datetime
# updated_at :datetime
#

View file

@ -42,25 +42,25 @@ end
#
# Table name: articles
#
# id :integer not null, primary key
# id :integer(4) not null, primary key
# name :string(255) default(""), not null
# supplier_id :integer default(0), not null
# article_category_id :integer default(0), not null
# supplier_id :integer(4) default(0), not null
# article_category_id :integer(4) default(0), not null
# unit :string(255) default(""), not null
# note :string(255)
# availability :boolean default(TRUE), not null
# availability :boolean(1) default(TRUE), not null
# manufacturer :string(255)
# origin :string(255)
# shared_updated_on :datetime
# price :decimal(8, 2)
# tax :float
# deposit :decimal(8, 2) default(0.0)
# unit_quantity :integer default(1), not null
# unit_quantity :integer(4) default(1), not null
# order_number :string(255)
# created_at :datetime
# updated_at :datetime
# deleted_at :datetime
# type :string(255)
# quantity :integer default(0)
# quantity :integer(4) default(0)
#

View file

@ -1,16 +1,3 @@
# == Schema Information
#
# Table name: stock_changes
#
# id :integer not null, primary key
# delivery_id :integer
# order_id :integer
# stock_article_id :integer
# quantity :integer default(0)
# created_at :datetime
# stock_taking_id :integer
#
class StockChange < ActiveRecord::Base
belongs_to :delivery
belongs_to :order
@ -28,3 +15,17 @@ class StockChange < ActiveRecord::Base
stock_article.update_quantity!
end
end
# == Schema Information
#
# Table name: stock_changes
#
# id :integer(4) not null, primary key
# delivery_id :integer(4)
# order_id :integer(4)
# stock_article_id :integer(4)
# quantity :integer(4) default(0)
# created_at :datetime
# stock_taking_id :integer(4)
#

View file

@ -1,13 +1,3 @@
# == Schema Information
#
# Table name: stock_takings
#
# id :integer not null, primary key
# date :date
# note :text
# created_at :datetime
#
class StockTaking < ActiveRecord::Base
has_many :stock_changes, :dependent => :destroy
@ -21,3 +11,14 @@ class StockTaking < ActiveRecord::Base
end
end
end
# == Schema Information
#
# Table name: stock_takings
#
# id :integer(4) not null, primary key
# date :date
# note :text
# created_at :datetime
#

View file

@ -1,25 +1,3 @@
# == Schema Information
#
# Table name: suppliers
#
# id :integer not null, primary key
# name :string(255) default(""), not null
# address :string(255) default(""), not null
# phone :string(255) default(""), not null
# phone2 :string(255)
# fax :string(255)
# email :string(255)
# url :string(255)
# contact_person :string(255)
# customer_number :string(255)
# delivery_days :string(255)
# order_howto :string(255)
# note :string(255)
# shared_supplier_id :integer
# min_order_quantity :string(255)
# deleted_at :datetime
#
class Supplier < ActiveRecord::Base
acts_as_paranoid # Avoid deleting the supplier for consistency of order-results
@ -84,3 +62,26 @@ class Supplier < ActiveRecord::Base
return [updated_articles, outlisted_articles]
end
end
# == Schema Information
#
# Table name: suppliers
#
# id :integer(4) not null, primary key
# name :string(255) default(""), not null
# address :string(255) default(""), not null
# phone :string(255) default(""), not null
# phone2 :string(255)
# fax :string(255)
# email :string(255)
# url :string(255)
# contact_person :string(255)
# customer_number :string(255)
# delivery_days :string(255)
# order_howto :string(255)
# note :string(255)
# shared_supplier_id :integer(4)
# min_order_quantity :string(255)
# deleted_at :datetime
#

View file

@ -77,17 +77,17 @@ end
#
# Table name: tasks
#
# id :integer not null, primary key
# id :integer(4) not null, primary key
# name :string(255) default(""), not null
# description :string(255)
# due_date :date
# done :boolean default(FALSE)
# workgroup_id :integer
# assigned :boolean default(FALSE)
# done :boolean(1) default(FALSE)
# workgroup_id :integer(4)
# assigned :boolean(1) default(FALSE)
# created_on :datetime not null
# updated_on :datetime not null
# required_users :integer default(1)
# weekly :boolean
# duration :integer default(1)
# required_users :integer(4) default(1)
# weekly :boolean(1)
# duration :integer(4) default(1)
#

View file

@ -1,21 +1,3 @@
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# nick :string(255) default(""), not null
# password_hash :string(255) default(""), not null
# password_salt :string(255) default(""), not null
# first_name :string(255) default(""), not null
# last_name :string(255) default(""), not null
# email :string(255) default(""), not null
# phone :string(255)
# created_on :datetime not null
# reset_password_token :string(255)
# reset_password_expires :datetime
# last_login :datetime
#
require 'digest/sha1'
# specific user rights through memberships (see Group)
class User < ActiveRecord::Base
@ -195,3 +177,22 @@ class User < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: users
#
# id :integer(4) not null, primary key
# nick :string(255) default(""), not null
# password_hash :string(255) default(""), not null
# password_salt :string(255) default(""), not null
# first_name :string(255) default(""), not null
# last_name :string(255) default(""), not null
# email :string(255) default(""), not null
# phone :string(255)
# created_on :datetime not null
# reset_password_token :string(255)
# reset_password_expires :datetime
# last_login :datetime
#

View file

@ -49,28 +49,28 @@ end
#
# Table name: groups
#
# id :integer not null, primary key
# id :integer(4) not null, primary key
# type :string(255) default(""), not null
# name :string(255) default(""), not null
# description :string(255)
# account_balance :decimal(, ) default(0.0), not null
# account_balance :decimal(8, 2) default(0.0), not null
# account_updated :datetime
# created_on :datetime not null
# role_admin :boolean default(FALSE), not null
# role_suppliers :boolean default(FALSE), not null
# role_article_meta :boolean default(FALSE), not null
# role_finance :boolean default(FALSE), not null
# role_orders :boolean default(FALSE), not null
# weekly_task :boolean default(FALSE)
# weekday :integer
# role_admin :boolean(1) default(FALSE), not null
# role_suppliers :boolean(1) default(FALSE), not null
# role_article_meta :boolean(1) default(FALSE), not null
# role_finance :boolean(1) default(FALSE), not null
# role_orders :boolean(1) default(FALSE), not null
# weekly_task :boolean(1) default(FALSE)
# weekday :integer(4)
# task_name :string(255)
# task_description :string(255)
# task_required_users :integer default(1)
# task_required_users :integer(4) default(1)
# deleted_at :datetime
# contact_person :string(255)
# contact_phone :string(255)
# contact_address :string(255)
# stats :text
# task_duration :integer default(1)
# task_duration :integer(4) default(1)
#