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.
- checksums.yaml +8 -8
- data/README.rdoc +3 -11
- data/app/controllers/mechanize_store/orders_controller.rb +2 -2
- data/app/models/mechanize_store/order.rb +24 -3
- data/app/models/mechanize_store/payment.rb +67 -4
- data/app/models/mechanize_store/payment_type.rb +2 -0
- data/app/views/mechanize_store/orders/index.html.erb +4 -4
- data/config/locales/mechanize_store.pt-BR.yml +28 -8
- data/db/migrate/20140602124615_rename_columns.rb +7 -0
- data/lib/mechanize_store/version.rb +1 -1
- data/spec/controllers/mechanize_store/orders_controller_spec.rb +2 -4
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +7 -25
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +124 -0
- data/spec/dummy/log/test.log +4733 -0
- data/spec/dummy/public/photos/1/medium.png +0 -0
- data/spec/dummy/public/photos/1/thumb.png +0 -0
- data/spec/factories/{store_flags.rb → mechanize_store_flags.rb} +0 -0
- data/spec/factories/{store_payments.rb → mechanize_store_payments.rb} +0 -0
- data/spec/factories/{store_product_categories.rb → mechanize_store_product_categories.rb} +0 -0
- data/spec/factories/{store_product_photos.rb → mechanize_store_product_photos.rb} +0 -0
- data/spec/factories/{store_stores.rb → mechanize_store_stores.rb} +0 -0
- data/spec/models/{store → mechanize_store}/flag_spec.rb +0 -0
- data/spec/models/{store → mechanize_store}/freight_spec.rb +0 -0
- data/spec/models/{store → mechanize_store}/order_spec.rb +0 -0
- data/spec/models/{store → mechanize_store}/payment_spec.rb +0 -0
- data/spec/models/{store → mechanize_store}/product_category_spec.rb +0 -0
- data/spec/models/{store → mechanize_store}/product_photo_spec.rb +0 -0
- data/spec/models/{store → mechanize_store}/product_spec.rb +0 -0
- data/spec/models/{store → mechanize_store}/store_spec.rb +0 -0
- metadata +29 -103
- data/app/controllers/mechanize_store/order_statuses_controller.rb +0 -77
- data/app/controllers/mechanize_store/payment_statuses_controller.rb +0 -77
- data/app/controllers/mechanize_store/payment_types_controller.rb +0 -77
- data/app/models/mechanize_store/order_status.rb +0 -10
- data/app/models/mechanize_store/payment_status.rb +0 -20
- data/app/views/mechanize_store/order_statuses/_form.html.erb +0 -11
- data/app/views/mechanize_store/order_statuses/edit.html.erb +0 -12
- data/app/views/mechanize_store/order_statuses/index.html.erb +0 -46
- data/app/views/mechanize_store/order_statuses/new.html.erb +0 -9
- data/app/views/mechanize_store/order_statuses/show.html.erb +0 -15
- data/app/views/mechanize_store/payment_statuses/_form.html.erb +0 -11
- data/app/views/mechanize_store/payment_statuses/edit.html.erb +0 -12
- data/app/views/mechanize_store/payment_statuses/index.html.erb +0 -46
- data/app/views/mechanize_store/payment_statuses/new.html.erb +0 -9
- data/app/views/mechanize_store/payment_statuses/show.html.erb +0 -15
- data/app/views/mechanize_store/payment_types/_form.html.erb +0 -11
- data/app/views/mechanize_store/payment_types/edit.html.erb +0 -12
- data/app/views/mechanize_store/payment_types/index.html.erb +0 -46
- data/app/views/mechanize_store/payment_types/new.html.erb +0 -9
- data/app/views/mechanize_store/payment_types/show.html.erb +0 -15
- data/db/migrate/20140401203246_create_mechanize_store_order_statuses.rb +0 -9
- data/db/migrate/20140402140318_create_mechanize_store_payment_statuses.rb +0 -9
- data/db/migrate/20140402140325_create_mechanize_store_payment_types.rb +0 -9
- data/spec/controllers/mechanize_store/order_statuses_controller_spec.rb +0 -138
- data/spec/controllers/mechanize_store/payment_statuses_controller_spec.rb +0 -139
- data/spec/controllers/mechanize_store/payment_types_controller_spec.rb +0 -139
- data/spec/dummy/db/migrate/20140508135827_create_mechanize_store_freights.mechanize_store.rb +0 -13
- data/spec/dummy/db/migrate/20140508135828_create_mechanize_store_order_statuses.mechanize_store.rb +0 -10
- data/spec/dummy/db/migrate/20140508135829_create_mechanize_store_payment_statuses.mechanize_store.rb +0 -10
- data/spec/dummy/db/migrate/20140508135830_create_mechanize_store_payment_types.mechanize_store.rb +0 -10
- data/spec/dummy/db/migrate/20140508135831_create_mechanize_store_payments.mechanize_store.rb +0 -16
- data/spec/dummy/db/migrate/20140508135832_create_mechanize_store_flags.mechanize_store.rb +0 -10
- data/spec/dummy/db/migrate/20140508135833_create_mechanize_store_products.mechanize_store.rb +0 -17
- data/spec/dummy/db/migrate/20140508135834_create_mechanize_store_product_photos.mechanize_store.rb +0 -11
- data/spec/dummy/db/migrate/20140508135835_create_mechanize_store_orders.mechanize_store.rb +0 -12
- data/spec/dummy/db/migrate/20140508135836_create_mechanize_store_product_categories.mechanize_store.rb +0 -11
- data/spec/dummy/db/migrate/20140508135837_add_width_to_mechanize_store_product.mechanize_store.rb +0 -7
- data/spec/dummy/db/migrate/20140508135838_create_mechanize_store_order_items.mechanize_store.rb +0 -13
- data/spec/dummy/db/migrate/20140508135839_add_payment_type_id_to_payment.mechanize_store.rb +0 -7
- data/spec/dummy/db/migrate/20140508135840_add_time_to_freight.mechanize_store.rb +0 -6
- data/spec/factories/mechanize_store_payment_types.rb +0 -7
- data/spec/factories/store_order_statuses.rb +0 -7
- data/spec/factories/store_payment_statuses.rb +0 -7
- data/spec/models/store/order_status_spec.rb +0 -7
- data/spec/models/store/payment_status_spec.rb +0 -7
- data/spec/models/store/payment_type_spec.rb +0 -7
- data/spec/routing/store/order_statuses_routing_spec.rb +0 -39
- data/spec/routing/store/payment_statuses_routing_spec.rb +0 -38
- 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
|
-
|
4
|
+
MjMwMTc4MzYxZDMyNGMzNDJlNjBhYjQ5MzE0NjUwYjZhMDcwYjdjMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjM3OTRmOWIyMjhhZmYxOGU5ZjkzNzQ5MzY5YTQ5MmY5MDI4Y2JjOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTIwYzE1MDAxYWU4MDg2MTJkNzBhYzI1NTc5OGUzMTkzNTNmZjMxZDI0NjA1
|
10
|
+
MDBmYjhhYWM2ZTY4MTJhOTIzZmMyYzI2ZGMxZmFiZWIzYjlkNGNjNmE3MDA5
|
11
|
+
NzE5YWU0Y2EzMzVkNTQ0YzVmOTFiZmJhODkzNDczOTYwY2JjNzQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
-
|
51
|
+
- payment_status
|
52
|
+
- payment_type
|
61
53
|
|
62
54
|
* Order
|
63
|
-
-
|
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 =
|
11
|
-
@payment_statuses =
|
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
|
-
|
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, :
|
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.
|
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 :
|
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.
|
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
|
@@ -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 :
|
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 :
|
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, :
|
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, :
|
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
|
-
|
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
|
-
|
39
|
-
|
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
|
@@ -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:
|
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:
|
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
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -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:
|
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 "
|
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", ["
|
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 "
|
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 "
|
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", ["
|
90
|
-
add_index "mechanize_store_payments", ["
|
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"
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -25494,3 +25494,127 @@ Migrating to AddTimeToFreight (20140508135840)
|
|
25494
25494
|
[1m[36m (0.7ms)[0m [1mcommit transaction[0m
|
25495
25495
|
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
25496
25496
|
[1m[36mMechanizeStore::Product Load (0.3ms)[0m [1mSELECT "mechanize_store_products".* FROM "mechanize_store_products" ORDER BY "mechanize_store_products"."id" ASC LIMIT 1[0m
|
25497
|
+
[1m[36mMechanizeStore::Order Load (0.5ms)[0m [1mSELECT "mechanize_store_orders".* FROM "mechanize_store_orders" ORDER BY "mechanize_store_orders"."id" ASC LIMIT 1[0m
|
25498
|
+
[1m[35mMechanizeStore::Order Load (0.2ms)[0m SELECT "mechanize_store_orders".* FROM "mechanize_store_orders" ORDER BY "mechanize_store_orders"."id" ASC LIMIT 1
|
25499
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
25500
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
25501
|
+
[1m[36mMechanizeStore::Order Load (0.2ms)[0m [1mSELECT "mechanize_store_orders".* FROM "mechanize_store_orders" ORDER BY "mechanize_store_orders"."id" ASC LIMIT 1[0m
|
25502
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
25503
|
+
Migrating to CreateMechanizeStoreFreights (20140401203200)
|
25504
|
+
[1m[35m (0.1ms)[0m begin transaction
|
25505
|
+
[1m[36m (0.2ms)[0m [1mCREATE 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) [0m
|
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
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
25508
|
+
[1m[36m (1.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
25509
|
+
[1m[35m (0.9ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
25510
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
25511
|
+
Migrating to CreateMechanizeStoreFreights (20140401203200)
|
25512
|
+
[1m[35m (0.1ms)[0m begin transaction
|
25513
|
+
[1m[36m (0.4ms)[0m [1mCREATE 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) [0m
|
25514
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_freights_on_order_id" ON "mechanize_store_freights" ("order_id")
|
25515
|
+
[1m[36mSQL (2.0ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140401203200"]]
|
25516
|
+
[1m[35m (0.9ms)[0m commit transaction
|
25517
|
+
Migrating to CreateMechanizeStorePayments (20140402140539)
|
25518
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25519
|
+
[1m[35m (0.3ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_mechanize_store_payments_on_payment_status_id" ON "mechanize_store_payments" ("payment_status_id")[0m
|
25521
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_payments_on_flag_id" ON "mechanize_store_payments" ("flag_id")
|
25522
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140402140539"]]
|
25523
|
+
[1m[35m (0.7ms)[0m commit transaction
|
25524
|
+
Migrating to CreateMechanizeStoreFlags (20140402140549)
|
25525
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25526
|
+
[1m[35m (0.4ms)[0m CREATE TABLE "mechanize_store_flags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
|
25527
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140402140549"]]
|
25528
|
+
[1m[35m (0.8ms)[0m commit transaction
|
25529
|
+
Migrating to CreateMechanizeStoreProducts (20140402140832)
|
25530
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25531
|
+
[1m[35m (0.3ms)[0m 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
|
+
[1m[36m (0.2ms)[0m [1mCREATE INDEX "index_mechanize_store_products_on_product_category_id" ON "mechanize_store_products" ("product_category_id")[0m
|
25533
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140402140832"]]
|
25534
|
+
[1m[36m (0.7ms)[0m [1mcommit transaction[0m
|
25535
|
+
Migrating to CreateMechanizeStoreProductPhotos (20140402140942)
|
25536
|
+
[1m[35m (0.1ms)[0m begin transaction
|
25537
|
+
[1m[36m (0.3ms)[0m [1mCREATE 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) [0m
|
25538
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_product_photos_on_product_id" ON "mechanize_store_product_photos" ("product_id")
|
25539
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140402140942"]]
|
25540
|
+
[1m[35m (0.6ms)[0m commit transaction
|
25541
|
+
Migrating to CreateMechanizeStoreOrders (20140402153139)
|
25542
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25543
|
+
[1m[35m (0.3ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_mechanize_store_orders_on_order_status_id" ON "mechanize_store_orders" ("order_status_id")[0m
|
25545
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_orders_on_store_id" ON "mechanize_store_orders" ("store_id")
|
25546
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140402153139"]]
|
25547
|
+
[1m[35m (1.0ms)[0m commit transaction
|
25548
|
+
Migrating to CreateMechanizeStoreProductCategories (20140402192058)
|
25549
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25550
|
+
[1m[35m (0.4ms)[0m 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
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140402192058"]]
|
25552
|
+
[1m[35m (0.7ms)[0m commit transaction
|
25553
|
+
Migrating to AddWidthToMechanizeStoreProduct (20140407193412)
|
25554
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25555
|
+
[1m[35m (0.9ms)[0m ALTER TABLE "mechanize_store_products" ADD "width" float
|
25556
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140407193412"]]
|
25557
|
+
[1m[35m (0.7ms)[0m commit transaction
|
25558
|
+
Migrating to CreateMechanizeStoreOrderItems (20140409191426)
|
25559
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25560
|
+
[1m[35m (0.3ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_mechanize_store_order_items_on_order_id" ON "mechanize_store_order_items" ("order_id")[0m
|
25562
|
+
[1m[35m (0.2ms)[0m CREATE INDEX "index_mechanize_store_order_items_on_product_id" ON "mechanize_store_order_items" ("product_id")
|
25563
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140409191426"]]
|
25564
|
+
[1m[35m (0.8ms)[0m commit transaction
|
25565
|
+
Migrating to AddPaymentTypeIdToPayment (20140416123100)
|
25566
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
25567
|
+
[1m[35m (0.4ms)[0m ALTER TABLE "mechanize_store_payments" ADD "payment_type_id" integer
|
25568
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_mechanize_store_payments_on_payment_type_id" ON "mechanize_store_payments" ("payment_type_id")[0m
|
25569
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140416123100"]]
|
25570
|
+
[1m[36m (0.8ms)[0m [1mcommit transaction[0m
|
25571
|
+
Migrating to AddTimeToFreight (20140417200520)
|
25572
|
+
[1m[35m (0.1ms)[0m begin transaction
|
25573
|
+
[1m[36m (0.5ms)[0m [1mALTER TABLE "mechanize_store_freights" ADD "delivery_time" integer[0m
|
25574
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140417200520"]]
|
25575
|
+
[1m[36m (0.7ms)[0m [1mcommit transaction[0m
|
25576
|
+
Migrating to RenameColumns (20140602124615)
|
25577
|
+
[1m[35m (0.1ms)[0m begin transaction
|
25578
|
+
[1m[36m (1.1ms)[0m [1mCREATE 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) [0m
|
25579
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "tindex_amechanize_store_orders_on_store_id" ON "amechanize_store_orders" ("store_id")
|
25580
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "tindex_amechanize_store_orders_on_order_status_id" ON "amechanize_store_orders" ("order_status")[0m
|
25581
|
+
[1m[35m (0.1ms)[0m SELECT * FROM "mechanize_store_orders"
|
25582
|
+
[1m[36m (0.3ms)[0m [1mDROP TABLE "mechanize_store_orders"[0m
|
25583
|
+
[1m[35m (0.4ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_mechanize_store_orders_on_order_status_id" ON "mechanize_store_orders" ("order_status")[0m
|
25585
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_orders_on_store_id" ON "mechanize_store_orders" ("store_id")
|
25586
|
+
[1m[36m (0.0ms)[0m [1mSELECT * FROM "amechanize_store_orders"[0m
|
25587
|
+
[1m[35m (0.4ms)[0m DROP TABLE "amechanize_store_orders"
|
25588
|
+
[1m[36m (0.3ms)[0m [1mDROP INDEX "index_mechanize_store_orders_on_order_status_id"[0m
|
25589
|
+
[1m[35m (0.2ms)[0m CREATE INDEX "index_mechanize_store_orders_on_order_status" ON "mechanize_store_orders" ("order_status")
|
25590
|
+
[1m[36m (0.1ms)[0m [1mCREATE 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) [0m
|
25591
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "tindex_amechanize_store_payments_on_payment_type_id" ON "amechanize_store_payments" ("payment_type")
|
25592
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "tindex_amechanize_store_payments_on_flag_id" ON "amechanize_store_payments" ("flag_id")[0m
|
25593
|
+
[1m[35m (0.2ms)[0m CREATE INDEX "tindex_amechanize_store_payments_on_payment_status_id" ON "amechanize_store_payments" ("payment_status_id")
|
25594
|
+
[1m[36m (0.1ms)[0m [1mSELECT * FROM "mechanize_store_payments"[0m
|
25595
|
+
[1m[35m (0.2ms)[0m DROP TABLE "mechanize_store_payments"
|
25596
|
+
[1m[36m (0.1ms)[0m [1mCREATE 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) [0m
|
25597
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_payments_on_payment_status_id" ON "mechanize_store_payments" ("payment_status_id")
|
25598
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "index_mechanize_store_payments_on_flag_id" ON "mechanize_store_payments" ("flag_id")[0m
|
25599
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_payments_on_payment_type_id" ON "mechanize_store_payments" ("payment_type")
|
25600
|
+
[1m[36m (0.1ms)[0m [1mSELECT * FROM "amechanize_store_payments"[0m
|
25601
|
+
[1m[35m (0.2ms)[0m DROP TABLE "amechanize_store_payments"
|
25602
|
+
[1m[36m (0.1ms)[0m [1mDROP INDEX "index_mechanize_store_payments_on_payment_type_id"[0m
|
25603
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_payments_on_payment_type" ON "mechanize_store_payments" ("payment_type")
|
25604
|
+
[1m[36m (0.1ms)[0m [1mCREATE 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) [0m
|
25605
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "tindex_amechanize_store_payments_on_payment_type" ON "amechanize_store_payments" ("payment_type")
|
25606
|
+
[1m[36m (0.1ms)[0m [1mCREATE INDEX "tindex_amechanize_store_payments_on_flag_id" ON "amechanize_store_payments" ("flag_id")[0m
|
25607
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "tindex_amechanize_store_payments_on_payment_status_id" ON "amechanize_store_payments" ("payment_status")
|
25608
|
+
[1m[36m (0.1ms)[0m [1mSELECT * FROM "mechanize_store_payments"[0m
|
25609
|
+
[1m[35m (0.2ms)[0m DROP TABLE "mechanize_store_payments"
|
25610
|
+
[1m[36m (0.1ms)[0m [1mCREATE 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) [0m
|
25611
|
+
[1m[35m (0.1ms)[0m CREATE INDEX "index_mechanize_store_payments_on_payment_status_id" ON "mechanize_store_payments" ("payment_status")
|
25612
|
+
[1m[36m (0.2ms)[0m [1mCREATE INDEX "index_mechanize_store_payments_on_flag_id" ON "mechanize_store_payments" ("flag_id")[0m
|
25613
|
+
[1m[35m (0.3ms)[0m CREATE INDEX "index_mechanize_store_payments_on_payment_type" ON "mechanize_store_payments" ("payment_type")
|
25614
|
+
[1m[36m (0.1ms)[0m [1mSELECT * FROM "amechanize_store_payments"[0m
|
25615
|
+
[1m[35m (0.2ms)[0m DROP TABLE "amechanize_store_payments"
|
25616
|
+
[1m[36m (0.1ms)[0m [1mDROP INDEX "index_mechanize_store_payments_on_payment_status_id"[0m
|
25617
|
+
[1m[35m (0.2ms)[0m CREATE INDEX "index_mechanize_store_payments_on_payment_status" ON "mechanize_store_payments" ("payment_status")
|
25618
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140602124615"]]
|
25619
|
+
[1m[35m (1.2ms)[0m commit transaction
|
25620
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|