mechanize_store 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +8 -8
  2. data/README.rdoc +3 -11
  3. data/app/controllers/mechanize_store/orders_controller.rb +2 -2
  4. data/app/models/mechanize_store/order.rb +24 -3
  5. data/app/models/mechanize_store/payment.rb +67 -4
  6. data/app/models/mechanize_store/payment_type.rb +2 -0
  7. data/app/views/mechanize_store/orders/index.html.erb +4 -4
  8. data/config/locales/mechanize_store.pt-BR.yml +28 -8
  9. data/db/migrate/20140602124615_rename_columns.rb +7 -0
  10. data/lib/mechanize_store/version.rb +1 -1
  11. data/spec/controllers/mechanize_store/orders_controller_spec.rb +2 -4
  12. data/spec/dummy/db/development.sqlite3 +0 -0
  13. data/spec/dummy/db/schema.rb +7 -25
  14. data/spec/dummy/db/test.sqlite3 +0 -0
  15. data/spec/dummy/log/development.log +124 -0
  16. data/spec/dummy/log/test.log +4733 -0
  17. data/spec/dummy/public/photos/1/medium.png +0 -0
  18. data/spec/dummy/public/photos/1/thumb.png +0 -0
  19. data/spec/factories/{store_flags.rb → mechanize_store_flags.rb} +0 -0
  20. data/spec/factories/{store_payments.rb → mechanize_store_payments.rb} +0 -0
  21. data/spec/factories/{store_product_categories.rb → mechanize_store_product_categories.rb} +0 -0
  22. data/spec/factories/{store_product_photos.rb → mechanize_store_product_photos.rb} +0 -0
  23. data/spec/factories/{store_stores.rb → mechanize_store_stores.rb} +0 -0
  24. data/spec/models/{store → mechanize_store}/flag_spec.rb +0 -0
  25. data/spec/models/{store → mechanize_store}/freight_spec.rb +0 -0
  26. data/spec/models/{store → mechanize_store}/order_spec.rb +0 -0
  27. data/spec/models/{store → mechanize_store}/payment_spec.rb +0 -0
  28. data/spec/models/{store → mechanize_store}/product_category_spec.rb +0 -0
  29. data/spec/models/{store → mechanize_store}/product_photo_spec.rb +0 -0
  30. data/spec/models/{store → mechanize_store}/product_spec.rb +0 -0
  31. data/spec/models/{store → mechanize_store}/store_spec.rb +0 -0
  32. metadata +29 -103
  33. data/app/controllers/mechanize_store/order_statuses_controller.rb +0 -77
  34. data/app/controllers/mechanize_store/payment_statuses_controller.rb +0 -77
  35. data/app/controllers/mechanize_store/payment_types_controller.rb +0 -77
  36. data/app/models/mechanize_store/order_status.rb +0 -10
  37. data/app/models/mechanize_store/payment_status.rb +0 -20
  38. data/app/views/mechanize_store/order_statuses/_form.html.erb +0 -11
  39. data/app/views/mechanize_store/order_statuses/edit.html.erb +0 -12
  40. data/app/views/mechanize_store/order_statuses/index.html.erb +0 -46
  41. data/app/views/mechanize_store/order_statuses/new.html.erb +0 -9
  42. data/app/views/mechanize_store/order_statuses/show.html.erb +0 -15
  43. data/app/views/mechanize_store/payment_statuses/_form.html.erb +0 -11
  44. data/app/views/mechanize_store/payment_statuses/edit.html.erb +0 -12
  45. data/app/views/mechanize_store/payment_statuses/index.html.erb +0 -46
  46. data/app/views/mechanize_store/payment_statuses/new.html.erb +0 -9
  47. data/app/views/mechanize_store/payment_statuses/show.html.erb +0 -15
  48. data/app/views/mechanize_store/payment_types/_form.html.erb +0 -11
  49. data/app/views/mechanize_store/payment_types/edit.html.erb +0 -12
  50. data/app/views/mechanize_store/payment_types/index.html.erb +0 -46
  51. data/app/views/mechanize_store/payment_types/new.html.erb +0 -9
  52. data/app/views/mechanize_store/payment_types/show.html.erb +0 -15
  53. data/db/migrate/20140401203246_create_mechanize_store_order_statuses.rb +0 -9
  54. data/db/migrate/20140402140318_create_mechanize_store_payment_statuses.rb +0 -9
  55. data/db/migrate/20140402140325_create_mechanize_store_payment_types.rb +0 -9
  56. data/spec/controllers/mechanize_store/order_statuses_controller_spec.rb +0 -138
  57. data/spec/controllers/mechanize_store/payment_statuses_controller_spec.rb +0 -139
  58. data/spec/controllers/mechanize_store/payment_types_controller_spec.rb +0 -139
  59. data/spec/dummy/db/migrate/20140508135827_create_mechanize_store_freights.mechanize_store.rb +0 -13
  60. data/spec/dummy/db/migrate/20140508135828_create_mechanize_store_order_statuses.mechanize_store.rb +0 -10
  61. data/spec/dummy/db/migrate/20140508135829_create_mechanize_store_payment_statuses.mechanize_store.rb +0 -10
  62. data/spec/dummy/db/migrate/20140508135830_create_mechanize_store_payment_types.mechanize_store.rb +0 -10
  63. data/spec/dummy/db/migrate/20140508135831_create_mechanize_store_payments.mechanize_store.rb +0 -16
  64. data/spec/dummy/db/migrate/20140508135832_create_mechanize_store_flags.mechanize_store.rb +0 -10
  65. data/spec/dummy/db/migrate/20140508135833_create_mechanize_store_products.mechanize_store.rb +0 -17
  66. data/spec/dummy/db/migrate/20140508135834_create_mechanize_store_product_photos.mechanize_store.rb +0 -11
  67. data/spec/dummy/db/migrate/20140508135835_create_mechanize_store_orders.mechanize_store.rb +0 -12
  68. data/spec/dummy/db/migrate/20140508135836_create_mechanize_store_product_categories.mechanize_store.rb +0 -11
  69. data/spec/dummy/db/migrate/20140508135837_add_width_to_mechanize_store_product.mechanize_store.rb +0 -7
  70. data/spec/dummy/db/migrate/20140508135838_create_mechanize_store_order_items.mechanize_store.rb +0 -13
  71. data/spec/dummy/db/migrate/20140508135839_add_payment_type_id_to_payment.mechanize_store.rb +0 -7
  72. data/spec/dummy/db/migrate/20140508135840_add_time_to_freight.mechanize_store.rb +0 -6
  73. data/spec/factories/mechanize_store_payment_types.rb +0 -7
  74. data/spec/factories/store_order_statuses.rb +0 -7
  75. data/spec/factories/store_payment_statuses.rb +0 -7
  76. data/spec/models/store/order_status_spec.rb +0 -7
  77. data/spec/models/store/payment_status_spec.rb +0 -7
  78. data/spec/models/store/payment_type_spec.rb +0 -7
  79. data/spec/routing/store/order_statuses_routing_spec.rb +0 -39
  80. data/spec/routing/store/payment_statuses_routing_spec.rb +0 -38
  81. data/spec/routing/store/payment_types_routing_spec.rb +0 -38
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODA1ZWFiMWU2ODJkODYyMWM0Y2MwMzUxMWRjYzFjNGQxYTlkOTRlMw==
4
+ MjMwMTc4MzYxZDMyNGMzNDJlNjBhYjQ5MzE0NjUwYjZhMDcwYjdjMg==
5
5
  data.tar.gz: !binary |-
6
- MWZkZmViZDExYzgzYzE3ZjRmMTJjYzIxNmI5YWFkZDNkOGQwY2I4OQ==
6
+ YjM3OTRmOWIyMjhhZmYxOGU5ZjkzNzQ5MzY5YTQ5MmY5MDI4Y2JjOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjdkYzFlNWMzYTI0ZjdiMDMwMjBhZDg2MzUzMTY0Y2Y1YmRmMWZlNDM3YjNh
10
- Zjc5ZmI5YzkzMGFhNWUyZGNlNjQ2ODY3M2Q1YTdmOTc1MTc5YWEwMmM1NWRi
11
- ZWM4Yzc1YTkwZmM3OWFmYTMzM2MzOGQyOWVjNzY1ZmM4MGQ3NTU=
9
+ OTIwYzE1MDAxYWU4MDg2MTJkNzBhYzI1NTc5OGUzMTkzNTNmZjMxZDI0NjA1
10
+ MDBmYjhhYWM2ZTY4MTJhOTIzZmMyYzI2ZGMxZmFiZWIzYjlkNGNjNmE3MDA5
11
+ NzE5YWU0Y2EzMzVkNTQ0YzVmOTFiZmJhODkzNDczOTYwY2JjNzQ=
12
12
  data.tar.gz: !binary |-
13
- ZjVlODMxMThlZDMxNTAwYTEzNDBjY2Q3Yjg5ZWZlMzUzOGJlNmQ5MWQ2NTc5
14
- YmUzOGJiNjk2NTk3ZGZhNDcyOGY5YzYxZTIzYWIxZGE2NmNkODUwYmI2ZDg3
15
- OWYwNmZlMTlkOWFmZTFiYjI4Mjc0OGNlZjI4MzdkYjUxYTg4YjU=
13
+ M2UyNWE1MTZiZWVmNjVmZGFlYTQ0NGM2OTVjMTFjODlhMjMyOGFkNTYzYjcy
14
+ YTA5ODI3MmMyM2YzNDZiY2IxYzgzNDEwMmNkNDY2OGNmYTU3NDBhNWM1ZTFl
15
+ NWM3MGE5ZTljZmRkNDAzNjFiMjBlNjRmZGFkMDEyMGJkMjMzZjg=
data/README.rdoc CHANGED
@@ -25,15 +25,6 @@ These project was created to encapsulate a commom models of an MechanizeStore ap
25
25
  * Flag (For credit cards flag)
26
26
  - name
27
27
 
28
- * PaymentType (ex: :credit, :debit, :billet)
29
- - name
30
-
31
- * PaymentStatus (ex: :paid, :awayting, :canceled)
32
- - name
33
-
34
- * OrderStatus (ex: :accomplished, :delivered, :canceled)
35
- - name
36
-
37
28
  * ProductCategory
38
29
  - name
39
30
 
@@ -57,10 +48,11 @@ These project was created to encapsulate a commom models of an MechanizeStore ap
57
48
  - paid_value
58
49
  - paid_in
59
50
  - flag_id
60
- - payment_status_id
51
+ - payment_status
52
+ - payment_type
61
53
 
62
54
  * Order
63
- - order_status_id
55
+ - order_status
64
56
  - store
65
57
  - delivery_date
66
58
 
@@ -7,8 +7,8 @@ module MechanizeStore
7
7
  before_action :fetch_collections, only: [:index]
8
8
 
9
9
  def fetch_collections
10
- @order_statuses = OrderStatus.all
11
- @payment_statuses = PaymentStatus.all
10
+ @order_statuses = Order.statuses_collection
11
+ @payment_statuses = Payment.statuses_collection
12
12
  end
13
13
 
14
14
  def index
@@ -1,6 +1,13 @@
1
1
  module MechanizeStore
2
2
  class Order < ActiveRecord::Base
3
- belongs_to :order_status
3
+
4
+ STATUSES = {
5
+ 1 => :accomplished,
6
+ 2 => :submited,
7
+ 3 => :delivered,
8
+ 4 => :canceled
9
+ }
10
+
4
11
  belongs_to :store
5
12
 
6
13
  has_one :payment
@@ -15,10 +22,24 @@ module MechanizeStore
15
22
  before_create :set_defaults
16
23
  after_create :after_create
17
24
 
18
- validates :payment, :order_status_id, :freight, presence: true
25
+ validates :payment, :freight, presence: true
26
+
27
+ def order_status_str
28
+ return I18n.t(STATUSES[self.order_status], scope: "order_statuses")
29
+ end
30
+
31
+ def self.statuses_collection
32
+ statuses_collection = []
33
+
34
+ STATUSES.each_pair do |key, value|
35
+ statuses_collection << [I18n.t(value, scope: "order_statuses"), key]
36
+ end
37
+
38
+ return statuses_collection
39
+ end
19
40
 
20
41
  def set_defaults
21
- self.order_status_id = OrderStatus::ACCOMPLISHED
42
+ self.order_status = STATUSES.invert[:submited]
22
43
  end
23
44
 
24
45
  def after_create
@@ -1,16 +1,79 @@
1
1
  module MechanizeStore
2
2
  class Payment < ActiveRecord::Base
3
3
  belongs_to :order
4
- belongs_to :payment_status
5
- belongs_to :payment_type
6
4
  belongs_to :flag
7
5
 
8
- validates :payment_type_id, :flag_id, presence: true
6
+ # validates :flag_id, presence: true, :if => Proc.new{|p| p.payment_type == Payment::TYPES.invert[:credit_card] }
7
+
8
+ #ids inseridos na base de dados
9
+ STATUSES = {
10
+ 1 => :accomplished,
11
+ 2 => :in_analisis,
12
+ 3 => :awaiting,
13
+ 4 => :canceled,
14
+ 5 => :unauthorized
15
+ }
16
+
17
+ TYPES = {
18
+ 1 => :credit_card,
19
+ 2 => :debit_card,
20
+ 3 => :billet
21
+ }
22
+
23
+ validates :payment_type, presence: true
9
24
 
10
25
  before_create :before_create
11
26
 
27
+ def confirm!
28
+ Payment.transaction do
29
+ self.update_attributes(payment_status: STATUSES.invert[:accomplished], paid_in: Time.now)
30
+ self.order.update_attribute(:order_status, Order::STATUSES.invert[:accomplished])
31
+ end
32
+ end
33
+
34
+ def decline!
35
+ Payment.transaction do
36
+ self.update_attributes(payment_status: STATUSES.invert[:unauthorized])
37
+ end
38
+ end
39
+
40
+ def payment_status_str
41
+ return I18n.t(STATUSES[self.payment_status], scope: "payment_statuses")
42
+ end
43
+
44
+ def payment_type_str
45
+ return I18n.t(TYPES[self.payment_type], scope: "payment_types")
46
+ end
47
+
48
+ def self.statuses_collection
49
+ statuses_collection = []
50
+
51
+ STATUSES.each_pair do |key, value|
52
+ statuses_collection << [I18n.t(value, scope: "payment_statuses")]
53
+ end
54
+
55
+ return statuses_collection
56
+ end
57
+
58
+ def self.types_collection
59
+ types_collection = []
60
+
61
+ TYPES.each_pair do |key, value|
62
+ types_collection << [I18n.t(value, scope: "payment_types"), key]
63
+ end
64
+
65
+ return types_collection
66
+ end
67
+
12
68
  def before_create
13
- self.payment_status_id = PaymentStatus::AWAITING
69
+ self.payment_status = STATUSES.invert[:awaiting]
70
+ end
71
+
72
+ def payment_status_label
73
+ return "success" if self.payment_status == STATUSES.invert[:accomplished]
74
+ return "warning" if self.payment_status == STATUSES.invert[:awaiting] or self.payment_status == STATUSES.invert[:in_analisis]
75
+ return "info" if self.payment_status == STATUSES.invert[:canceled]
76
+ return "danger" if self.payment_type == STATUSES.invert[:unauthorized] or self.payment_status = STATUSES.invert[:need_authorization]
14
77
  end
15
78
  end
16
79
  end
@@ -1,5 +1,7 @@
1
1
  module MechanizeStore
2
2
  class PaymentType < ActiveRecord::Base
3
3
  validates :name, presence: true
4
+ CREDIT_CARD = 2
5
+ BILLET = 1
4
6
  end
5
7
  end
@@ -5,11 +5,11 @@
5
5
  <div class="form-group">
6
6
  <div class="row">
7
7
  <div class="col-lg-2">
8
- <%= f.select :order_status_id_eq, options_for_select(@order_statuses.collect{|c| [c.name, c.id]}, params[:q][:order_status_id_eq].to_i), { :include_blank => t(:order_status, scope: "activerecord.models.mechanize_store") }, { class: "form-control" } %>
8
+ <%= f.select :order_status_eq, options_for_select(@order_statuses.collect{|c| [c.name, c.id]}, params[:q][:order_status_eq].to_i), { :include_blank => t(:order_status, scope: "activerecord.models.mechanize_store") }, { class: "form-control" } %>
9
9
  </div>
10
10
 
11
11
  <div class="col-lg-2">
12
- <%= f.select :payment_payment_status_id_eq, options_for_select(@payment_statuses.collect{|c| [c.name, c.id]}, params[:q][:payment_payment_status_id_eq].to_i), { :include_blank => t(:payment_status, scope: "activerecord.models.mechanize_store") }, { class: "form-control" } %>
12
+ <%= f.select :payment_payment_status_eq, options_for_select(@payment_statuses.collect{|c| [c.name, c.id]}, params[:q][:payment_payment_status_eq].to_i), { :include_blank => t(:payment_status, scope: "activerecord.models.mechanize_store") }, { class: "form-control" } %>
13
13
  </div>
14
14
 
15
15
  <div class="col-lg-2">
@@ -45,9 +45,9 @@
45
45
  <thead>
46
46
  <tr>
47
47
  <th><%= sort_link(@search, :id, t(:id, scope: "activerecord.attributes") ) %></th>
48
- <th><%= sort_link(@search, :order_status_id, t(:order_status_id, scope: "activerecord.attributes.mechanize_store/order") ) %></th>
48
+ <th><%= sort_link(@search, :order_status, t(:order_status_id, scope: "activerecord.attributes.mechanize_store/order") ) %></th>
49
49
  <th>
50
- <%= sort_link(@search, :order_payment_payment_status_name, t(:payment_status_id, scope: "activerecord.attributes.mechanize_store/payment") ) %>
50
+ <%= sort_link(@search, :order_payment_payment_status, t(:payment_status, scope: "activerecord.attributes.mechanize_store/payment") ) %>
51
51
  </th>
52
52
  <th><%= sort_link(@search, :generated_at, t(:generated_at, scope: "activerecord.attributes.mechanize_store/order") ) %></th>
53
53
  <th><%= sort_link(@search, :delivery_date, t(:delivery_date, scope: "activerecord.attributes.mechanize_store/order") ) %></th>
@@ -12,6 +12,25 @@ pt-BR:
12
12
  products_list: "Lista de produtos"
13
13
  search: "Buscar"
14
14
 
15
+ order_status:
16
+ accomplished: Efetuada
17
+ submited: Aguardando
18
+ delivered: Entregue
19
+ canceled: Cancelada
20
+
21
+ payment_status:
22
+ accomplished: Efetuado
23
+ in_analisis: Em análise
24
+ awaiting: Aguardando pagamento
25
+ canceled: Cancelado
26
+ unauthorized: Não autorizado
27
+ need_authorization: Necessita de autorização
28
+
29
+ payment_types:
30
+ credit_card: Cartão de crédito
31
+ debit_card: Cartão de débito
32
+ billet: Boleto
33
+
15
34
  helpers:
16
35
  select:
17
36
  prompt: Por favor selecione
@@ -31,26 +50,26 @@ pt-BR:
31
50
  created_at: "Criada em"
32
51
  delivery_date: "Data da entrega"
33
52
  generated_at: "Gerada em"
34
- order_status_id: "Status da compra"
53
+ order_status: "Status da compra"
54
+ track_code: Código de rastreamento
35
55
  mechanize_store/order_status:
36
56
  name: Nome
37
57
  mechanize_store/payment:
38
- payment_type_id: "Tipo de pagamento"
39
- payment_status_id: "Status do pagamento"
40
- mechanize_store/payment_status:
41
- name: "Nome"
42
- mechanize_store/payment_type:
43
- name: "Nome"
58
+ payment_type: "Tipo de pagamento"
59
+ payment_status: "Status do pagamento"
44
60
  mechanize_store/product:
45
61
  description: Descrição
46
62
  height: Altura
47
63
  length: Comprimento
48
64
  name: Nome
49
65
  price: Preço
66
+ product_category_id: "Categoria"
67
+ quantity: Quantidade
50
68
  short_description: Resumo
69
+ total_value: Valor total
70
+ unit_value: Valor unitário
51
71
  weight: Peso
52
72
  width: Largura
53
- product_category_id: "Categoria"
54
73
  mechanize_store/product_category:
55
74
  name: "Nome"
56
75
  product_category: "Categoria de produto"
@@ -58,6 +77,7 @@ pt-BR:
58
77
  models:
59
78
  mechanize_store:
60
79
  flag: "Bandeira"
80
+ freight: Frete
61
81
  order: "Compra"
62
82
  order_status: "Status de compra"
63
83
  payment: "Pagamento"
@@ -0,0 +1,7 @@
1
+ class RenameColumns < ActiveRecord::Migration
2
+ def change
3
+ rename_column :mechanize_store_orders, :order_status_id, :order_status
4
+ rename_column :mechanize_store_payments, :payment_type_id, :payment_type
5
+ rename_column :mechanize_store_payments, :payment_status_id, :payment_status
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module MechanizeStore
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -5,12 +5,10 @@ module MechanizeStore
5
5
  routes { MechanizeStore::Engine.routes }
6
6
 
7
7
  before do
8
- @payment_type = FactoryGirl.create(:mechanize_store_payment_type)
9
8
  @flag = FactoryGirl.create(:mechanize_store_flag)
10
- @payment = FactoryGirl.build(:mechanize_store_payment, payment_type: @payment_type, flag: @flag)
11
- @order_status = FactoryGirl.create(:mechanize_store_order_status)
9
+ @payment = FactoryGirl.build(:mechanize_store_payment, payment_type: Payment::TYPES.invert[:credit_card], flag: @flag)
12
10
  @freight = FactoryGirl.create(:mechanize_store_freight)
13
- @order = FactoryGirl.create(:mechanize_store_order, payment: @payment, order_status: @order_status, freight: @freight)
11
+ @order = FactoryGirl.create(:mechanize_store_order, payment: @payment, order_status: Order::STATUSES.invert[:submited], freight: @freight)
14
12
  end
15
13
 
16
14
  let(:valid_session) { {} }
Binary file
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20140508135840) do
14
+ ActiveRecord::Schema.define(version: 20140602124615) do
15
15
 
16
16
  create_table "mechanize_store_flags", force: true do |t|
17
17
  t.string "name"
@@ -43,38 +43,20 @@ ActiveRecord::Schema.define(version: 20140508135840) do
43
43
  add_index "mechanize_store_order_items", ["order_id"], name: "index_mechanize_store_order_items_on_order_id"
44
44
  add_index "mechanize_store_order_items", ["product_id"], name: "index_mechanize_store_order_items_on_product_id"
45
45
 
46
- create_table "mechanize_store_order_statuses", force: true do |t|
47
- t.string "name"
48
- t.datetime "created_at"
49
- t.datetime "updated_at"
50
- end
51
-
52
46
  create_table "mechanize_store_orders", force: true do |t|
53
- t.integer "order_status_id"
47
+ t.integer "order_status"
54
48
  t.integer "store_id"
55
49
  t.datetime "delivery_date"
56
50
  t.datetime "created_at"
57
51
  t.datetime "updated_at"
58
52
  end
59
53
 
60
- add_index "mechanize_store_orders", ["order_status_id"], name: "index_mechanize_store_orders_on_order_status_id"
54
+ add_index "mechanize_store_orders", ["order_status"], name: "index_mechanize_store_orders_on_order_status"
61
55
  add_index "mechanize_store_orders", ["store_id"], name: "index_mechanize_store_orders_on_store_id"
62
56
 
63
- create_table "mechanize_store_payment_statuses", force: true do |t|
64
- t.string "name"
65
- t.datetime "created_at"
66
- t.datetime "updated_at"
67
- end
68
-
69
- create_table "mechanize_store_payment_types", force: true do |t|
70
- t.string "name"
71
- t.datetime "created_at"
72
- t.datetime "updated_at"
73
- end
74
-
75
57
  create_table "mechanize_store_payments", force: true do |t|
76
58
  t.integer "order_id"
77
- t.integer "payment_status_id"
59
+ t.integer "payment_status"
78
60
  t.float "value"
79
61
  t.float "paid_value"
80
62
  t.datetime "paid_in"
@@ -82,12 +64,12 @@ ActiveRecord::Schema.define(version: 20140508135840) do
82
64
  t.integer "flag_id"
83
65
  t.datetime "created_at"
84
66
  t.datetime "updated_at"
85
- t.integer "payment_type_id"
67
+ t.integer "payment_type"
86
68
  end
87
69
 
88
70
  add_index "mechanize_store_payments", ["flag_id"], name: "index_mechanize_store_payments_on_flag_id"
89
- add_index "mechanize_store_payments", ["payment_status_id"], name: "index_mechanize_store_payments_on_payment_status_id"
90
- add_index "mechanize_store_payments", ["payment_type_id"], name: "index_mechanize_store_payments_on_payment_type_id"
71
+ add_index "mechanize_store_payments", ["payment_status"], name: "index_mechanize_store_payments_on_payment_status"
72
+ add_index "mechanize_store_payments", ["payment_type"], name: "index_mechanize_store_payments_on_payment_type"
91
73
 
92
74
  create_table "mechanize_store_product_categories", force: true do |t|
93
75
  t.string "name"
Binary file
@@ -25494,3 +25494,127 @@ Migrating to AddTimeToFreight (20140508135840)
25494
25494
   (0.7ms) commit transaction
25495
25495
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
25496
25496
  MechanizeStore::Product Load (0.3ms) SELECT "mechanize_store_products".* FROM "mechanize_store_products" ORDER BY "mechanize_store_products"."id" ASC LIMIT 1
25497
+ MechanizeStore::Order Load (0.5ms) SELECT "mechanize_store_orders".* FROM "mechanize_store_orders" ORDER BY "mechanize_store_orders"."id" ASC LIMIT 1
25498
+ MechanizeStore::Order Load (0.2ms) SELECT "mechanize_store_orders".* FROM "mechanize_store_orders" ORDER BY "mechanize_store_orders"."id" ASC LIMIT 1
25499
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
25500
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
25501
+ MechanizeStore::Order Load (0.2ms) SELECT "mechanize_store_orders".* FROM "mechanize_store_orders" ORDER BY "mechanize_store_orders"."id" ASC LIMIT 1
25502
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
25503
+ Migrating to CreateMechanizeStoreFreights (20140401203200)
25504
+  (0.1ms) begin transaction
25505
+  (0.2ms) CREATE TABLE "mechanize_store_freights" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "value" float, "service" varchar(255), "order_id" integer, "zipcode" varchar(255), "created_at" datetime, "updated_at" datetime) 
25506
+ SQLite3::SQLException: table "mechanize_store_freights" already exists: CREATE TABLE "mechanize_store_freights" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "value" float, "service" varchar(255), "order_id" integer, "zipcode" varchar(255), "created_at" datetime, "updated_at" datetime)
25507
+  (0.1ms) rollback transaction
25508
+  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
25509
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
25510
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
25511
+ Migrating to CreateMechanizeStoreFreights (20140401203200)
25512
+  (0.1ms) begin transaction
25513
+  (0.4ms) CREATE TABLE "mechanize_store_freights" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "value" float, "service" varchar(255), "order_id" integer, "zipcode" varchar(255), "created_at" datetime, "updated_at" datetime) 
25514
+  (0.1ms) CREATE INDEX "index_mechanize_store_freights_on_order_id" ON "mechanize_store_freights" ("order_id")
25515
+ SQL (2.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140401203200"]]
25516
+  (0.9ms) commit transaction
25517
+ Migrating to CreateMechanizeStorePayments (20140402140539)
25518
+  (0.1ms) begin transaction
25519
+  (0.3ms) CREATE TABLE "mechanize_store_payments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_id" integer, "payment_status_id" integer, "value" float, "paid_value" float, "paid_in" datetime, "plot" integer, "flag_id" integer, "created_at" datetime, "updated_at" datetime)
25520
+  (0.1ms) CREATE INDEX "index_mechanize_store_payments_on_payment_status_id" ON "mechanize_store_payments" ("payment_status_id")
25521
+  (0.1ms) CREATE INDEX "index_mechanize_store_payments_on_flag_id" ON "mechanize_store_payments" ("flag_id")
25522
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140402140539"]]
25523
+  (0.7ms) commit transaction
25524
+ Migrating to CreateMechanizeStoreFlags (20140402140549)
25525
+  (0.1ms) begin transaction
25526
+  (0.4ms) CREATE TABLE "mechanize_store_flags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
25527
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140402140549"]]
25528
+  (0.8ms) commit transaction
25529
+ Migrating to CreateMechanizeStoreProducts (20140402140832)
25530
+  (0.1ms) begin transaction
25531
+  (0.3ms) CREATE TABLE "mechanize_store_products" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" text, "short_description" varchar(255), "price" float, "weight" float, "length" float, "height" float, "product_category_id" integer, "created_at" datetime, "updated_at" datetime)
25532
+  (0.2ms) CREATE INDEX "index_mechanize_store_products_on_product_category_id" ON "mechanize_store_products" ("product_category_id")
25533
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140402140832"]]
25534
+  (0.7ms) commit transaction
25535
+ Migrating to CreateMechanizeStoreProductPhotos (20140402140942)
25536
+  (0.1ms) begin transaction
25537
+  (0.3ms) CREATE TABLE "mechanize_store_product_photos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "file_file_name" varchar(255), "file_content_type" varchar(255), "file_file_size" integer, "file_updated_at" datetime, "product_id" integer, "created_at" datetime, "updated_at" datetime) 
25538
+  (0.1ms) CREATE INDEX "index_mechanize_store_product_photos_on_product_id" ON "mechanize_store_product_photos" ("product_id")
25539
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140402140942"]]
25540
+  (0.6ms) commit transaction
25541
+ Migrating to CreateMechanizeStoreOrders (20140402153139)
25542
+  (0.1ms) begin transaction
25543
+  (0.3ms) CREATE TABLE "mechanize_store_orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_status_id" integer, "store_id" integer, "delivery_date" datetime, "created_at" datetime, "updated_at" datetime)
25544
+  (0.1ms) CREATE INDEX "index_mechanize_store_orders_on_order_status_id" ON "mechanize_store_orders" ("order_status_id")
25545
+  (0.1ms) CREATE INDEX "index_mechanize_store_orders_on_store_id" ON "mechanize_store_orders" ("store_id")
25546
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140402153139"]]
25547
+  (1.0ms) commit transaction
25548
+ Migrating to CreateMechanizeStoreProductCategories (20140402192058)
25549
+  (0.1ms) begin transaction
25550
+  (0.4ms) CREATE TABLE "mechanize_store_product_categories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "product_category_id" integer, "created_at" datetime, "updated_at" datetime)
25551
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140402192058"]]
25552
+  (0.7ms) commit transaction
25553
+ Migrating to AddWidthToMechanizeStoreProduct (20140407193412)
25554
+  (0.1ms) begin transaction
25555
+  (0.9ms) ALTER TABLE "mechanize_store_products" ADD "width" float
25556
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140407193412"]]
25557
+  (0.7ms) commit transaction
25558
+ Migrating to CreateMechanizeStoreOrderItems (20140409191426)
25559
+  (0.1ms) begin transaction
25560
+  (0.3ms) CREATE TABLE "mechanize_store_order_items" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "quantity" integer, "price" float, "order_id" integer, "product_id" integer, "created_at" datetime, "updated_at" datetime)
25561
+  (0.1ms) CREATE INDEX "index_mechanize_store_order_items_on_order_id" ON "mechanize_store_order_items" ("order_id")
25562
+  (0.2ms) CREATE INDEX "index_mechanize_store_order_items_on_product_id" ON "mechanize_store_order_items" ("product_id")
25563
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140409191426"]]
25564
+  (0.8ms) commit transaction
25565
+ Migrating to AddPaymentTypeIdToPayment (20140416123100)
25566
+  (0.1ms) begin transaction
25567
+  (0.4ms) ALTER TABLE "mechanize_store_payments" ADD "payment_type_id" integer
25568
+  (0.1ms) CREATE INDEX "index_mechanize_store_payments_on_payment_type_id" ON "mechanize_store_payments" ("payment_type_id")
25569
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140416123100"]]
25570
+  (0.8ms) commit transaction
25571
+ Migrating to AddTimeToFreight (20140417200520)
25572
+  (0.1ms) begin transaction
25573
+  (0.5ms) ALTER TABLE "mechanize_store_freights" ADD "delivery_time" integer
25574
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140417200520"]]
25575
+  (0.7ms) commit transaction
25576
+ Migrating to RenameColumns (20140602124615)
25577
+  (0.1ms) begin transaction
25578
+  (1.1ms) CREATE TEMPORARY TABLE "amechanize_store_orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_status" integer, "store_id" integer, "delivery_date" datetime, "created_at" datetime, "updated_at" datetime) 
25579
+  (0.1ms) CREATE INDEX "tindex_amechanize_store_orders_on_store_id" ON "amechanize_store_orders" ("store_id")
25580
+  (0.1ms) CREATE INDEX "tindex_amechanize_store_orders_on_order_status_id" ON "amechanize_store_orders" ("order_status")
25581
+  (0.1ms) SELECT * FROM "mechanize_store_orders"
25582
+  (0.3ms) DROP TABLE "mechanize_store_orders"
25583
+  (0.4ms) CREATE TABLE "mechanize_store_orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_status" integer, "store_id" integer, "delivery_date" datetime, "created_at" datetime, "updated_at" datetime)
25584
+  (0.1ms) CREATE INDEX "index_mechanize_store_orders_on_order_status_id" ON "mechanize_store_orders" ("order_status")
25585
+  (0.1ms) CREATE INDEX "index_mechanize_store_orders_on_store_id" ON "mechanize_store_orders" ("store_id")
25586
+  (0.0ms) SELECT * FROM "amechanize_store_orders"
25587
+  (0.4ms) DROP TABLE "amechanize_store_orders"
25588
+  (0.3ms) DROP INDEX "index_mechanize_store_orders_on_order_status_id"
25589
+  (0.2ms) CREATE INDEX "index_mechanize_store_orders_on_order_status" ON "mechanize_store_orders" ("order_status")
25590
+  (0.1ms) CREATE TEMPORARY TABLE "amechanize_store_payments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_id" integer, "payment_status_id" integer, "value" float, "paid_value" float, "paid_in" datetime, "plot" integer, "flag_id" integer, "created_at" datetime, "updated_at" datetime, "payment_type" integer) 
25591
+  (0.1ms) CREATE INDEX "tindex_amechanize_store_payments_on_payment_type_id" ON "amechanize_store_payments" ("payment_type")
25592
+  (0.1ms) CREATE INDEX "tindex_amechanize_store_payments_on_flag_id" ON "amechanize_store_payments" ("flag_id")
25593
+  (0.2ms) CREATE INDEX "tindex_amechanize_store_payments_on_payment_status_id" ON "amechanize_store_payments" ("payment_status_id")
25594
+  (0.1ms) SELECT * FROM "mechanize_store_payments"
25595
+  (0.2ms) DROP TABLE "mechanize_store_payments"
25596
+  (0.1ms) CREATE TABLE "mechanize_store_payments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_id" integer, "payment_status_id" integer, "value" float, "paid_value" float, "paid_in" datetime, "plot" integer, "flag_id" integer, "created_at" datetime, "updated_at" datetime, "payment_type" integer) 
25597
+  (0.1ms) CREATE INDEX "index_mechanize_store_payments_on_payment_status_id" ON "mechanize_store_payments" ("payment_status_id")
25598
+  (0.1ms) CREATE INDEX "index_mechanize_store_payments_on_flag_id" ON "mechanize_store_payments" ("flag_id")
25599
+  (0.1ms) CREATE INDEX "index_mechanize_store_payments_on_payment_type_id" ON "mechanize_store_payments" ("payment_type")
25600
+  (0.1ms) SELECT * FROM "amechanize_store_payments"
25601
+  (0.2ms) DROP TABLE "amechanize_store_payments"
25602
+  (0.1ms) DROP INDEX "index_mechanize_store_payments_on_payment_type_id"
25603
+  (0.1ms) CREATE INDEX "index_mechanize_store_payments_on_payment_type" ON "mechanize_store_payments" ("payment_type")
25604
+  (0.1ms) CREATE TEMPORARY TABLE "amechanize_store_payments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_id" integer, "payment_status" integer, "value" float, "paid_value" float, "paid_in" datetime, "plot" integer, "flag_id" integer, "created_at" datetime, "updated_at" datetime, "payment_type" integer) 
25605
+  (0.1ms) CREATE INDEX "tindex_amechanize_store_payments_on_payment_type" ON "amechanize_store_payments" ("payment_type")
25606
+  (0.1ms) CREATE INDEX "tindex_amechanize_store_payments_on_flag_id" ON "amechanize_store_payments" ("flag_id")
25607
+  (0.1ms) CREATE INDEX "tindex_amechanize_store_payments_on_payment_status_id" ON "amechanize_store_payments" ("payment_status")
25608
+  (0.1ms) SELECT * FROM "mechanize_store_payments"
25609
+  (0.2ms) DROP TABLE "mechanize_store_payments"
25610
+  (0.1ms) CREATE TABLE "mechanize_store_payments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "order_id" integer, "payment_status" integer, "value" float, "paid_value" float, "paid_in" datetime, "plot" integer, "flag_id" integer, "created_at" datetime, "updated_at" datetime, "payment_type" integer) 
25611
+  (0.1ms) CREATE INDEX "index_mechanize_store_payments_on_payment_status_id" ON "mechanize_store_payments" ("payment_status")
25612
+  (0.2ms) CREATE INDEX "index_mechanize_store_payments_on_flag_id" ON "mechanize_store_payments" ("flag_id")
25613
+  (0.3ms) CREATE INDEX "index_mechanize_store_payments_on_payment_type" ON "mechanize_store_payments" ("payment_type")
25614
+  (0.1ms) SELECT * FROM "amechanize_store_payments"
25615
+  (0.2ms) DROP TABLE "amechanize_store_payments"
25616
+  (0.1ms) DROP INDEX "index_mechanize_store_payments_on_payment_status_id"
25617
+  (0.2ms) CREATE INDEX "index_mechanize_store_payments_on_payment_status" ON "mechanize_store_payments" ("payment_status")
25618
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140602124615"]]
25619
+  (1.2ms) commit transaction
25620
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"