class Alpha

Public Instance Methods

buyer(t) click to toggle source
# File lib/netfira/web_connect/db_schema/20140515_alpha.rb, line 13
def buyer(t)
  t.string :name
  t.string :contact
  t.string :email, limit: 100
  t.string :phone, limit: 30
  t.string :fax, limit: 30
  %w[billing_ shipping_].each do |type|
    t.string :"#{type}address1", limit: 150
    t.string :"#{type}address2", limit: 150
    t.string :"#{type}city", limit: 150
    t.string :"#{type}state", limit: 150
    t.string :"#{type}country", limit: 2
    t.string :"#{type}post_code", limit: 20
  end

end
change() click to toggle source
# File lib/netfira/web_connect/db_schema/20140515_alpha.rb, line 4
def change

  def product(t)
    t.decimal :unit_price, precision: 12, scale: 4
    t.decimal :unit_tax, precision: 12, scale: 4
    t.localized_string :part
    t.localized_string :description
  end

  def buyer(t)
    t.string :name
    t.string :contact
    t.string :email, limit: 100
    t.string :phone, limit: 30
    t.string :fax, limit: 30
    %w[billing_ shipping_].each do |type|
      t.string :"#{type}address1", limit: 150
      t.string :"#{type}address2", limit: 150
      t.string :"#{type}city", limit: 150
      t.string :"#{type}state", limit: 150
      t.string :"#{type}country", limit: 2
      t.string :"#{type}post_code", limit: 20
    end

  end

  create_record_table :products, with_l10n: true do |t|
    product t

    t.localized_string :category
    t.localized_string :long_description, limit: 0x10000

    t.decimal :stock, precision: 12, scale: 4
    t.string :stock_text

    t.integer :length
    t.integer :height
    t.integer :width
    t.decimal :weight, precision: 14, scale: 3

    t.boolean :show_on_website
  end

  create_record_table :categories, with_l10n: true, tree: true do |t|
    t.localized_string :name
  end

  create_record_table :buyers, origin_key: :nf_code do |t|
    buyer t

    t.binary :pin, limit: 255
    t.boolean :website_access
    t.boolean :allow_products
    t.boolean :restrict_products
  end

  create_record_table :orders, sendable: true do |t|
    t.string :nf_code
    buyer t

    t.string :buyer_reference
    t.string :currency_code, limit: 3

    t.string :shipping_method
    t.decimal :shipping_price, precision: 12, scale: 4
    t.decimal :shipping_tax, precision: 12, scale: 4
    t.string :shipping_account
    t.string :shipping_password

    t.string :payment_method
    t.boolean :payment_received
    t.string :payment_reference
    t.string :payment_error_code, limit: 16

    t.string :comment, limit: 0x10000
  end

  create_record_table :order_lines, writable: true do |t|
    t.string :product_id
    product t

    t.references :order
    t.decimal :quantity, precision: 12, scale: 4
    t.string :comment, limit: 0x10000
  end

  create_file_table :images do |t|
    t.float :focus_point_top
    t.float :focus_point_left
    t.integer :width
    t.integer :height
  end

  create_file_table :attachments

  create_relation_table :products, :images
  create_relation_table :products, :categories
  create_relation_table :products, :attachments
  create_relation_table :products, :buyers

end
product(t) click to toggle source
# File lib/netfira/web_connect/db_schema/20140515_alpha.rb, line 6
def product(t)
  t.decimal :unit_price, precision: 12, scale: 4
  t.decimal :unit_tax, precision: 12, scale: 4
  t.localized_string :part
  t.localized_string :description
end