spree 0.11.1 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree might be problematic. Click here for more details.
- data/CHANGELOG +4 -0
- data/app/controllers/admin/overview_controller.rb +1 -1
- data/app/controllers/admin/products_controller.rb +1 -0
- data/app/controllers/admin/users_controller.rb +2 -1
- data/app/controllers/spree/base_controller.rb +8 -2
- data/app/models/adjustment.rb +20 -0
- data/app/models/charge.rb +1 -17
- data/app/models/credit.rb +0 -16
- data/config/environment.rb +1 -1
- data/lib/spree.rb +1 -1
- data/test/functional/admin/adjustments_controller_test.rb +1 -1
- data/vendor/extensions/api/app/controllers/api/base_controller.rb +2 -3
- data/vendor/extensions/overview_dashboard/app/controllers/admin/overview_controller.rb +3 -1
- data/vendor/extensions/overview_dashboard/public/javascripts/dashboard.js +4 -4
- data/vendor/extensions/theme_default/app/views/shared/_admin_head.html.erb +2 -2
- data/vendor/extensions/theme_default/public/javascripts/admin/checkouts/edit.js +1 -1
- data/vendor/extensions/theme_default/public/javascripts/admin/orders/edit.js +1 -1
- metadata +4 -8
- data/config/database.yml +0 -7
- data/db/schema.rb +0 -555
data/CHANGELOG
CHANGED
@@ -8,7 +8,7 @@ class Admin::OverviewController < Admin::BaseController
|
|
8
8
|
#@users = User.find_with_deleted(:all, :order => 'updated_at desc')
|
9
9
|
# going to list today's orders, yesterday's orders, older orders
|
10
10
|
# have a filter / search at the top
|
11
|
-
# @orders, @
|
11
|
+
# @orders, @
|
12
12
|
end
|
13
13
|
|
14
14
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class Admin::UsersController < Admin::BaseController
|
2
2
|
resource_controller
|
3
|
+
before_filter :check_json_authenticity, :only => :index
|
3
4
|
before_filter :load_roles, :only => [:edit, :new, :update, :create]
|
4
5
|
|
5
6
|
create.after :save_user_roles
|
@@ -9,7 +10,7 @@ class Admin::UsersController < Admin::BaseController
|
|
9
10
|
wants.html { render :action => :index }
|
10
11
|
wants.json { render :json => @collection.to_json(:include => {:bill_address => {:include => [:state, :country]}, :ship_address => {:include => [:state, :country]}}) }
|
11
12
|
end
|
12
|
-
|
13
|
+
|
13
14
|
destroy.success.wants.js { render_js_for_destroy }
|
14
15
|
|
15
16
|
private
|
@@ -59,14 +59,20 @@ class Spree::BaseController < ActionController::Base
|
|
59
59
|
|
60
60
|
protected
|
61
61
|
|
62
|
+
# Index request for JSON needs to pass a CSRF token in order to prevent JSON Hijacking
|
63
|
+
def check_json_authenticity
|
64
|
+
return unless request.format.js? or request.format.json?
|
65
|
+
form_authenticity_token == params[request_forgery_protection_token] || raise(ActionController::InvalidAuthenticityToken)
|
66
|
+
end
|
67
|
+
|
62
68
|
def default_title
|
63
69
|
Spree::Config[:site_name]
|
64
70
|
end
|
65
|
-
|
71
|
+
|
66
72
|
def accurate_title
|
67
73
|
return nil
|
68
74
|
end
|
69
|
-
|
75
|
+
|
70
76
|
def reject_unknown_object
|
71
77
|
# workaround to catch problems with loading errors for permalink ids (reconsider RC permalink hack elsewhere?)
|
72
78
|
begin
|
data/app/models/adjustment.rb
CHANGED
@@ -30,6 +30,8 @@ class Adjustment < ActiveRecord::Base
|
|
30
30
|
belongs_to :order
|
31
31
|
belongs_to :adjustment_source, :polymorphic => true
|
32
32
|
|
33
|
+
before_save :ensure_correct_sign
|
34
|
+
|
33
35
|
validates_presence_of :description
|
34
36
|
validates_numericality_of :amount, :allow_nil => true
|
35
37
|
|
@@ -73,4 +75,22 @@ class Adjustment < ActiveRecord::Base
|
|
73
75
|
class << self
|
74
76
|
public :subclasses
|
75
77
|
end
|
78
|
+
|
79
|
+
private
|
80
|
+
# Ensure correct sign for amount field here. Moved from seperate filters on
|
81
|
+
# Credit / Charge as object is an Adjustment on create, so it wasn't firing
|
82
|
+
#
|
83
|
+
def ensure_correct_sign
|
84
|
+
return true if self.type.blank? #is an Adjustment
|
85
|
+
|
86
|
+
if self.type.constantize.new.is_a? Credit
|
87
|
+
if (db_amount = read_attribute(:amount)) && db_amount > 0
|
88
|
+
self.amount *= -1
|
89
|
+
end
|
90
|
+
elsif self.type.constantize.new.is_a? Charge
|
91
|
+
if (db_amount = read_attribute(:amount)) && db_amount < 0
|
92
|
+
self.amount *= -1
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
76
96
|
end
|
data/app/models/charge.rb
CHANGED
@@ -1,19 +1,3 @@
|
|
1
1
|
class Charge < Adjustment
|
2
|
-
before_save :ensure_positive_amount
|
3
2
|
|
4
|
-
|
5
|
-
# Ensures Charge has always positive amount.
|
6
|
-
#
|
7
|
-
# Amount should be modified ONLY when it's going to be saved to the database
|
8
|
-
# (read_attribute returns value)
|
9
|
-
#
|
10
|
-
# WARNING! It does not protect from Credits getting negative amounts while
|
11
|
-
# amount is autocalculated! Descending classes should ensure amount is always
|
12
|
-
# negative in their calculate_adjustment methods.
|
13
|
-
# This method should be threated as a last resort for keeping integrity of adjustments
|
14
|
-
def ensure_positive_amount
|
15
|
-
if (db_amount = read_attribute(:amount)) && db_amount < 0
|
16
|
-
self.amount *= -1
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
3
|
+
end
|
data/app/models/credit.rb
CHANGED
@@ -1,19 +1,3 @@
|
|
1
1
|
class Credit < Adjustment
|
2
|
-
before_save :ensure_negative_amount
|
3
2
|
|
4
|
-
private
|
5
|
-
# Ensures Charge always has negative amount.
|
6
|
-
#
|
7
|
-
# Amount shold be modified ONLY when it's going to be saved to the database
|
8
|
-
# (read_attribute returns value)
|
9
|
-
#
|
10
|
-
# WARNING! It does not protect from Credits getting positive amounts while
|
11
|
-
# amount is autocalculated! Descending classes should ensure amount is always
|
12
|
-
# negative in their calculate_adjustment methods
|
13
|
-
# This method should be threated as a last resort for keeping integrity of adjustments
|
14
|
-
def ensure_negative_amount
|
15
|
-
if (db_amount = read_attribute(:amount)) && db_amount > 0
|
16
|
-
self.amount *= -1
|
17
|
-
end
|
18
|
-
end
|
19
3
|
end
|
data/config/environment.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# ENV['RAILS_ENV'] ||= 'production'
|
6
6
|
|
7
7
|
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
-
SPREE_GEM_VERSION = '0.11.
|
8
|
+
SPREE_GEM_VERSION = '0.11.2' unless defined? SPREE_GEM_VERSION
|
9
9
|
|
10
10
|
# Bootstrap the Rails environment, frameworks, and default configuration
|
11
11
|
require File.join(File.dirname(__FILE__), 'boot')
|
data/lib/spree.rb
CHANGED
@@ -113,7 +113,7 @@ class Admin::AdjustmentsControllerTest < ActionController::TestCase
|
|
113
113
|
should_respond_with :redirect
|
114
114
|
|
115
115
|
should_change("@order.total", :by => -5.00) { @order.total.to_f }
|
116
|
-
should_change("@order.credits.total", :by => 5.00) { @order.credits.total.to_f }
|
116
|
+
should_change("@order.credits.total", :by => -5.00) { @order.credits.total.to_f }
|
117
117
|
should_change("Adjustment.count", :by => 1) { Adjustment.count }
|
118
118
|
should_change("Credit.count", :by => 1) { Credit.count }
|
119
119
|
end
|
@@ -25,9 +25,8 @@ class Api::BaseController < Spree::BaseController
|
|
25
25
|
|
26
26
|
define_method :admin_token_passed_in_headers do
|
27
27
|
token = request.headers['X-SpreeAPIKey']
|
28
|
-
return
|
29
|
-
@current_user = User.find_by_api_key(token)
|
30
|
-
@current_user.has_role? 'admin'
|
28
|
+
return access_denied unless token
|
29
|
+
return access_denied unless @current_user = User.find_by_api_key(token)
|
31
30
|
end
|
32
31
|
|
33
32
|
define_method :end_of_association_chain do
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# this clas was inspired (heavily) from the mephisto admin architecture
|
2
2
|
|
3
3
|
class Admin::OverviewController < Admin::BaseController
|
4
|
+
before_filter :check_json_authenticity, :only => :get_report_data
|
5
|
+
|
4
6
|
#todo, add rss feed of information that is happening
|
5
7
|
|
6
8
|
def index
|
@@ -57,7 +59,7 @@ class Admin::OverviewController < Admin::BaseController
|
|
57
59
|
["completed_at >= ?", params[:from]]
|
58
60
|
end
|
59
61
|
end
|
60
|
-
|
62
|
+
|
61
63
|
def fill_empty_entries(orders, params)
|
62
64
|
from_date = params[:from].to_date
|
63
65
|
to_date = (params[:to] || Time.now).to_date
|
@@ -95,15 +95,15 @@ jQuery(document).ready(function(){
|
|
95
95
|
|
96
96
|
jQuery.ajax({
|
97
97
|
type: 'GET',
|
98
|
-
url: 'admin/overview/get_report_data',
|
99
|
-
data: ({report: 'orders_by_day', name: report, value: value
|
98
|
+
url: 'admin/overview/get_report_data?authenticity_token=' + AUTH_TOKEN,
|
99
|
+
data: ({report: 'orders_by_day', name: report, value: value}),
|
100
100
|
success: handle_orders_by_day
|
101
101
|
});
|
102
102
|
|
103
103
|
jQuery.ajax({
|
104
104
|
type: 'GET',
|
105
|
-
url: 'admin/overview/get_report_data',
|
106
|
-
data: ({report: 'orders_totals', name: report
|
105
|
+
url: 'admin/overview/get_report_data?authenticity_token=' + AUTH_TOKEN,
|
106
|
+
data: ({report: 'orders_totals', name: report}),
|
107
107
|
success: handle_orders_total
|
108
108
|
});
|
109
109
|
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<%= javascript_include_tag('jquery.template') unless controller.controller_name == "overview" %>
|
9
9
|
<%= javascript_include_tag 'spree', 'nested-attribute', 'zone', 'calculator', 'gateway' %>
|
10
10
|
<%= javascript_tag "$ = jQuery;" %>
|
11
|
-
<%= javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.inspect};"
|
11
|
+
<%= javascript_tag "var AUTH_TOKEN = encodeURIComponent(#{form_authenticity_token.inspect});" %>
|
12
12
|
<%= javascript_include_tag 'jquery.alerts/jquery.alerts.js' %>
|
13
13
|
<%= javascript_include_tag 'jquery.autocomplete.min.js' %>
|
14
14
|
|
@@ -17,5 +17,5 @@
|
|
17
17
|
<%= stylesheet_link_tag 'jquery.autocomplete.css' %>
|
18
18
|
|
19
19
|
<%= javascript_tag "jQuery.alerts.dialogClass = 'spree';" %>
|
20
|
-
<%= unobtrusive_datepicker_includes %>
|
20
|
+
<%= unobtrusive_datepicker_includes %>
|
21
21
|
<%= yield :head %>
|
@@ -40,7 +40,7 @@ jQuery(document).ready(function(){
|
|
40
40
|
});
|
41
41
|
}
|
42
42
|
|
43
|
-
$("#customer_search").autocomplete("/admin/users.json", {
|
43
|
+
$("#customer_search").autocomplete("/admin/users.json?authenticity_token=" + AUTH_TOKEN, {
|
44
44
|
minChars: 5,
|
45
45
|
delay: 1500,
|
46
46
|
parse: prep_autocomplete_data,
|
@@ -75,7 +75,7 @@ jQuery(document).ready(function(){
|
|
75
75
|
});
|
76
76
|
}
|
77
77
|
|
78
|
-
$("#add_product_name").autocomplete("/admin/products.json", {
|
78
|
+
$("#add_product_name").autocomplete("/admin/products.json?authenticity_token=" + AUTH_TOKEN, {
|
79
79
|
parse: prep_autocomplete_data,
|
80
80
|
formatItem: function(item) {
|
81
81
|
return format_autocomplete(item);
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 55
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 11
|
9
|
-
-
|
10
|
-
version: 0.11.
|
9
|
+
- 2
|
10
|
+
version: 0.11.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sean Schofield
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-01 00:00:00 -04:00
|
19
19
|
default_executable: spree
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -469,7 +469,6 @@ files:
|
|
469
469
|
- bin/spree
|
470
470
|
- config/boot.rb
|
471
471
|
- config/cucumber.yml
|
472
|
-
- config/database.yml
|
473
472
|
- config/database.yml.example
|
474
473
|
- config/environment.rb
|
475
474
|
- config/environments/cucumber.rb
|
@@ -576,7 +575,6 @@ files:
|
|
576
575
|
- db/sample/users.rb
|
577
576
|
- db/sample/users.yml
|
578
577
|
- db/sample/variants.yml
|
579
|
-
- db/schema.rb
|
580
578
|
- db/seeds.rb
|
581
579
|
- features/checkout.feature
|
582
580
|
- features/create_admin_user.feature
|
@@ -2141,8 +2139,6 @@ rdoc_options:
|
|
2141
2139
|
- --exclude
|
2142
2140
|
- log
|
2143
2141
|
- --exclude
|
2144
|
-
- pkg
|
2145
|
-
- --exclude
|
2146
2142
|
- public
|
2147
2143
|
- --exclude
|
2148
2144
|
- script
|
data/config/database.yml
DELETED
data/db/schema.rb
DELETED
@@ -1,555 +0,0 @@
|
|
1
|
-
# This file is auto-generated from the current state of the database. Instead of editing this file,
|
2
|
-
# please use the migrations feature of Active Record to incrementally modify your database, and
|
3
|
-
# then regenerate this schema definition.
|
4
|
-
#
|
5
|
-
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
|
6
|
-
# to create the application database on another system, you should be using db:schema:load, not running
|
7
|
-
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
8
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
9
|
-
#
|
10
|
-
# It's strongly recommended to check this file into your version control system.
|
11
|
-
|
12
|
-
ActiveRecord::Schema.define(:version => 20100624123336) do
|
13
|
-
|
14
|
-
create_table "addresses", :force => true do |t|
|
15
|
-
t.string "firstname"
|
16
|
-
t.string "lastname"
|
17
|
-
t.string "address1"
|
18
|
-
t.string "address2"
|
19
|
-
t.string "city"
|
20
|
-
t.integer "state_id"
|
21
|
-
t.string "zipcode"
|
22
|
-
t.integer "country_id"
|
23
|
-
t.string "phone"
|
24
|
-
t.datetime "created_at"
|
25
|
-
t.datetime "updated_at"
|
26
|
-
t.string "state_name"
|
27
|
-
t.string "alternative_phone"
|
28
|
-
end
|
29
|
-
|
30
|
-
add_index "addresses", ["firstname"], :name => "index_addresses_on_firstname"
|
31
|
-
add_index "addresses", ["lastname"], :name => "index_addresses_on_lastname"
|
32
|
-
|
33
|
-
create_table "adjustments", :force => true do |t|
|
34
|
-
t.integer "order_id"
|
35
|
-
t.string "type"
|
36
|
-
t.decimal "amount"
|
37
|
-
t.string "description"
|
38
|
-
t.integer "position"
|
39
|
-
t.datetime "created_at"
|
40
|
-
t.datetime "updated_at"
|
41
|
-
t.integer "adjustment_source_id"
|
42
|
-
t.string "adjustment_source_type"
|
43
|
-
end
|
44
|
-
|
45
|
-
add_index "adjustments", ["order_id"], :name => "index_adjustments_on_order_id"
|
46
|
-
|
47
|
-
create_table "assets", :force => true do |t|
|
48
|
-
t.integer "viewable_id"
|
49
|
-
t.string "viewable_type", :limit => 50
|
50
|
-
t.string "attachment_content_type"
|
51
|
-
t.string "attachment_file_name"
|
52
|
-
t.integer "attachment_size"
|
53
|
-
t.integer "position"
|
54
|
-
t.string "type", :limit => 75
|
55
|
-
t.datetime "attachment_updated_at"
|
56
|
-
t.integer "attachment_width"
|
57
|
-
t.integer "attachment_height"
|
58
|
-
t.text "alt"
|
59
|
-
end
|
60
|
-
|
61
|
-
add_index "assets", ["viewable_id"], :name => "index_assets_on_viewable_id"
|
62
|
-
add_index "assets", ["viewable_type", "type"], :name => "index_assets_on_viewable_type_and_type"
|
63
|
-
|
64
|
-
create_table "calculators", :force => true do |t|
|
65
|
-
t.string "type"
|
66
|
-
t.integer "calculable_id", :null => false
|
67
|
-
t.string "calculable_type", :null => false
|
68
|
-
t.datetime "created_at"
|
69
|
-
t.datetime "updated_at"
|
70
|
-
end
|
71
|
-
|
72
|
-
create_table "checkouts", :force => true do |t|
|
73
|
-
t.integer "order_id"
|
74
|
-
t.string "email"
|
75
|
-
t.string "ip_address"
|
76
|
-
t.text "special_instructions"
|
77
|
-
t.integer "bill_address_id"
|
78
|
-
t.datetime "created_at"
|
79
|
-
t.datetime "updated_at"
|
80
|
-
t.string "state"
|
81
|
-
t.integer "ship_address_id"
|
82
|
-
t.integer "shipping_method_id"
|
83
|
-
end
|
84
|
-
|
85
|
-
add_index "checkouts", ["bill_address_id"], :name => "index_checkouts_on_bill_address_id"
|
86
|
-
add_index "checkouts", ["order_id"], :name => "index_checkouts_on_order_id"
|
87
|
-
|
88
|
-
create_table "configurations", :force => true do |t|
|
89
|
-
t.string "name"
|
90
|
-
t.datetime "created_at"
|
91
|
-
t.datetime "updated_at"
|
92
|
-
t.string "type", :limit => 50
|
93
|
-
end
|
94
|
-
|
95
|
-
add_index "configurations", ["name", "type"], :name => "index_configurations_on_name_and_type"
|
96
|
-
|
97
|
-
create_table "countries", :force => true do |t|
|
98
|
-
t.string "iso_name"
|
99
|
-
t.string "iso"
|
100
|
-
t.string "name"
|
101
|
-
t.string "iso3"
|
102
|
-
t.integer "numcode"
|
103
|
-
end
|
104
|
-
|
105
|
-
create_table "coupons", :force => true do |t|
|
106
|
-
t.string "code"
|
107
|
-
t.string "description"
|
108
|
-
t.integer "usage_limit"
|
109
|
-
t.boolean "combine"
|
110
|
-
t.datetime "expires_at"
|
111
|
-
t.datetime "created_at"
|
112
|
-
t.datetime "updated_at"
|
113
|
-
t.datetime "starts_at"
|
114
|
-
end
|
115
|
-
|
116
|
-
create_table "creditcards", :force => true do |t|
|
117
|
-
t.text "number"
|
118
|
-
t.string "month"
|
119
|
-
t.string "year"
|
120
|
-
t.text "verification_value"
|
121
|
-
t.string "cc_type"
|
122
|
-
t.string "last_digits"
|
123
|
-
t.string "first_name"
|
124
|
-
t.string "last_name"
|
125
|
-
t.datetime "created_at"
|
126
|
-
t.datetime "updated_at"
|
127
|
-
t.string "start_month"
|
128
|
-
t.string "start_year"
|
129
|
-
t.string "issue_number"
|
130
|
-
t.integer "address_id"
|
131
|
-
t.string "gateway_customer_profile_id"
|
132
|
-
t.string "gateway_payment_profile_id"
|
133
|
-
end
|
134
|
-
|
135
|
-
create_table "gateways", :force => true do |t|
|
136
|
-
t.string "type"
|
137
|
-
t.string "name"
|
138
|
-
t.text "description"
|
139
|
-
t.boolean "active", :default => true
|
140
|
-
t.string "environment", :default => "development"
|
141
|
-
t.string "server", :default => "test"
|
142
|
-
t.boolean "test_mode", :default => true
|
143
|
-
t.datetime "created_at"
|
144
|
-
t.datetime "updated_at"
|
145
|
-
end
|
146
|
-
|
147
|
-
create_table "inventory_units", :force => true do |t|
|
148
|
-
t.integer "variant_id"
|
149
|
-
t.integer "order_id"
|
150
|
-
t.string "state"
|
151
|
-
t.integer "lock_version", :default => 0
|
152
|
-
t.datetime "created_at"
|
153
|
-
t.datetime "updated_at"
|
154
|
-
t.integer "shipment_id"
|
155
|
-
t.integer "return_authorization_id"
|
156
|
-
end
|
157
|
-
|
158
|
-
add_index "inventory_units", ["order_id"], :name => "index_inventory_units_on_order_id"
|
159
|
-
add_index "inventory_units", ["shipment_id"], :name => "index_inventory_units_on_shipment_id"
|
160
|
-
add_index "inventory_units", ["variant_id"], :name => "index_inventory_units_on_variant_id"
|
161
|
-
|
162
|
-
create_table "line_items", :force => true do |t|
|
163
|
-
t.integer "order_id"
|
164
|
-
t.integer "variant_id"
|
165
|
-
t.integer "quantity", :null => false
|
166
|
-
t.decimal "price", :precision => 8, :scale => 2, :null => false
|
167
|
-
t.datetime "created_at"
|
168
|
-
t.datetime "updated_at"
|
169
|
-
end
|
170
|
-
|
171
|
-
add_index "line_items", ["order_id"], :name => "index_line_items_on_order_id"
|
172
|
-
add_index "line_items", ["variant_id"], :name => "index_line_items_on_variant_id"
|
173
|
-
|
174
|
-
create_table "open_id_authentication_associations", :force => true do |t|
|
175
|
-
t.integer "issued"
|
176
|
-
t.integer "lifetime"
|
177
|
-
t.string "handle"
|
178
|
-
t.string "assoc_type"
|
179
|
-
t.binary "server_url"
|
180
|
-
t.binary "secret"
|
181
|
-
end
|
182
|
-
|
183
|
-
create_table "open_id_authentication_nonces", :force => true do |t|
|
184
|
-
t.integer "timestamp", :null => false
|
185
|
-
t.string "server_url"
|
186
|
-
t.string "salt", :null => false
|
187
|
-
end
|
188
|
-
|
189
|
-
create_table "option_types", :force => true do |t|
|
190
|
-
t.string "name", :limit => 100
|
191
|
-
t.string "presentation", :limit => 100
|
192
|
-
t.datetime "created_at"
|
193
|
-
t.datetime "updated_at"
|
194
|
-
end
|
195
|
-
|
196
|
-
create_table "option_types_prototypes", :id => false, :force => true do |t|
|
197
|
-
t.integer "prototype_id"
|
198
|
-
t.integer "option_type_id"
|
199
|
-
end
|
200
|
-
|
201
|
-
create_table "option_values", :force => true do |t|
|
202
|
-
t.integer "option_type_id"
|
203
|
-
t.string "name"
|
204
|
-
t.integer "position"
|
205
|
-
t.string "presentation"
|
206
|
-
t.datetime "created_at"
|
207
|
-
t.datetime "updated_at"
|
208
|
-
end
|
209
|
-
|
210
|
-
create_table "option_values_variants", :id => false, :force => true do |t|
|
211
|
-
t.integer "variant_id"
|
212
|
-
t.integer "option_value_id"
|
213
|
-
end
|
214
|
-
|
215
|
-
add_index "option_values_variants", ["variant_id", "option_value_id"], :name => "index_option_values_variants_on_variant_id_and_option_value_id"
|
216
|
-
add_index "option_values_variants", ["variant_id"], :name => "index_option_values_variants_on_variant_id"
|
217
|
-
|
218
|
-
create_table "orders", :force => true do |t|
|
219
|
-
t.integer "user_id"
|
220
|
-
t.string "number", :limit => 15
|
221
|
-
t.decimal "item_total", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
222
|
-
t.decimal "total", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
223
|
-
t.datetime "created_at"
|
224
|
-
t.datetime "updated_at"
|
225
|
-
t.string "state"
|
226
|
-
t.string "token"
|
227
|
-
t.decimal "adjustment_total", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
228
|
-
t.decimal "credit_total", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
229
|
-
t.datetime "completed_at"
|
230
|
-
end
|
231
|
-
|
232
|
-
add_index "orders", ["number"], :name => "index_orders_on_number"
|
233
|
-
|
234
|
-
create_table "payment_methods", :force => true do |t|
|
235
|
-
t.string "type"
|
236
|
-
t.string "name"
|
237
|
-
t.text "description"
|
238
|
-
t.boolean "active", :default => true
|
239
|
-
t.string "environment", :default => "development"
|
240
|
-
t.datetime "created_at"
|
241
|
-
t.datetime "updated_at"
|
242
|
-
t.datetime "deleted_at"
|
243
|
-
t.string "display_on"
|
244
|
-
end
|
245
|
-
|
246
|
-
create_table "payments", :force => true do |t|
|
247
|
-
t.integer "payable_id"
|
248
|
-
t.datetime "created_at"
|
249
|
-
t.datetime "updated_at"
|
250
|
-
t.decimal "amount", :default => 0.0, :null => false
|
251
|
-
t.string "payable_type"
|
252
|
-
t.integer "source_id"
|
253
|
-
t.string "source_type"
|
254
|
-
t.integer "payment_method_id"
|
255
|
-
end
|
256
|
-
|
257
|
-
create_table "preferences", :force => true do |t|
|
258
|
-
t.string "attribute", :limit => 100, :null => false
|
259
|
-
t.integer "owner_id", :limit => 30, :null => false
|
260
|
-
t.string "owner_type", :limit => 50, :null => false
|
261
|
-
t.integer "group_id"
|
262
|
-
t.string "group_type", :limit => 50
|
263
|
-
t.text "value", :limit => 255
|
264
|
-
t.datetime "created_at"
|
265
|
-
t.datetime "updated_at"
|
266
|
-
end
|
267
|
-
|
268
|
-
create_table "product_groups", :force => true do |t|
|
269
|
-
t.string "name"
|
270
|
-
t.string "permalink"
|
271
|
-
t.string "order"
|
272
|
-
end
|
273
|
-
|
274
|
-
add_index "product_groups", ["name"], :name => "index_product_groups_on_name"
|
275
|
-
add_index "product_groups", ["permalink"], :name => "index_product_groups_on_permalink"
|
276
|
-
|
277
|
-
create_table "product_groups_products", :id => false, :force => true do |t|
|
278
|
-
t.integer "product_id"
|
279
|
-
t.integer "product_group_id"
|
280
|
-
end
|
281
|
-
|
282
|
-
create_table "product_option_types", :force => true do |t|
|
283
|
-
t.integer "product_id"
|
284
|
-
t.integer "option_type_id"
|
285
|
-
t.integer "position"
|
286
|
-
t.datetime "created_at"
|
287
|
-
t.datetime "updated_at"
|
288
|
-
end
|
289
|
-
|
290
|
-
create_table "product_properties", :force => true do |t|
|
291
|
-
t.integer "product_id"
|
292
|
-
t.integer "property_id"
|
293
|
-
t.string "value"
|
294
|
-
t.datetime "created_at"
|
295
|
-
t.datetime "updated_at"
|
296
|
-
end
|
297
|
-
|
298
|
-
add_index "product_properties", ["product_id"], :name => "index_product_properties_on_product_id"
|
299
|
-
|
300
|
-
create_table "product_scopes", :force => true do |t|
|
301
|
-
t.integer "product_group_id"
|
302
|
-
t.string "name"
|
303
|
-
t.text "arguments"
|
304
|
-
end
|
305
|
-
|
306
|
-
add_index "product_scopes", ["name"], :name => "index_product_scopes_on_name"
|
307
|
-
add_index "product_scopes", ["product_group_id"], :name => "index_product_scopes_on_product_group_id"
|
308
|
-
|
309
|
-
create_table "products", :force => true do |t|
|
310
|
-
t.string "name", :default => "", :null => false
|
311
|
-
t.text "description"
|
312
|
-
t.datetime "created_at"
|
313
|
-
t.datetime "updated_at"
|
314
|
-
t.string "permalink"
|
315
|
-
t.datetime "available_on"
|
316
|
-
t.integer "tax_category_id"
|
317
|
-
t.integer "shipping_category_id"
|
318
|
-
t.datetime "deleted_at"
|
319
|
-
t.string "meta_description"
|
320
|
-
t.string "meta_keywords"
|
321
|
-
t.integer "count_on_hand", :default => 0, :null => false
|
322
|
-
end
|
323
|
-
|
324
|
-
add_index "products", ["available_on"], :name => "index_products_on_available_on"
|
325
|
-
add_index "products", ["deleted_at"], :name => "index_products_on_deleted_at"
|
326
|
-
add_index "products", ["name"], :name => "index_products_on_name"
|
327
|
-
add_index "products", ["permalink"], :name => "index_products_on_permalink"
|
328
|
-
|
329
|
-
create_table "products_taxons", :id => false, :force => true do |t|
|
330
|
-
t.integer "product_id"
|
331
|
-
t.integer "taxon_id"
|
332
|
-
end
|
333
|
-
|
334
|
-
add_index "products_taxons", ["product_id"], :name => "index_products_taxons_on_product_id"
|
335
|
-
add_index "products_taxons", ["taxon_id"], :name => "index_products_taxons_on_taxon_id"
|
336
|
-
|
337
|
-
create_table "properties", :force => true do |t|
|
338
|
-
t.string "name"
|
339
|
-
t.string "presentation", :null => false
|
340
|
-
t.datetime "created_at"
|
341
|
-
t.datetime "updated_at"
|
342
|
-
end
|
343
|
-
|
344
|
-
create_table "properties_prototypes", :id => false, :force => true do |t|
|
345
|
-
t.integer "prototype_id"
|
346
|
-
t.integer "property_id"
|
347
|
-
end
|
348
|
-
|
349
|
-
create_table "prototypes", :force => true do |t|
|
350
|
-
t.string "name"
|
351
|
-
t.datetime "created_at"
|
352
|
-
t.datetime "updated_at"
|
353
|
-
end
|
354
|
-
|
355
|
-
create_table "queued_mails", :force => true do |t|
|
356
|
-
t.text "object"
|
357
|
-
t.string "mailer"
|
358
|
-
end
|
359
|
-
|
360
|
-
create_table "return_authorizations", :force => true do |t|
|
361
|
-
t.string "number"
|
362
|
-
t.decimal "amount", :precision => 8, :scale => 2, :default => 0.0, :null => false
|
363
|
-
t.integer "order_id"
|
364
|
-
t.text "reason"
|
365
|
-
t.string "state"
|
366
|
-
t.datetime "created_at"
|
367
|
-
t.datetime "updated_at"
|
368
|
-
end
|
369
|
-
|
370
|
-
create_table "roles", :force => true do |t|
|
371
|
-
t.string "name"
|
372
|
-
end
|
373
|
-
|
374
|
-
create_table "roles_users", :id => false, :force => true do |t|
|
375
|
-
t.integer "role_id"
|
376
|
-
t.integer "user_id"
|
377
|
-
end
|
378
|
-
|
379
|
-
add_index "roles_users", ["role_id"], :name => "index_roles_users_on_role_id"
|
380
|
-
add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id"
|
381
|
-
|
382
|
-
create_table "shipments", :force => true do |t|
|
383
|
-
t.integer "order_id"
|
384
|
-
t.integer "shipping_method_id"
|
385
|
-
t.string "tracking"
|
386
|
-
t.datetime "created_at"
|
387
|
-
t.datetime "updated_at"
|
388
|
-
t.string "number"
|
389
|
-
t.decimal "cost", :precision => 8, :scale => 2
|
390
|
-
t.datetime "shipped_at"
|
391
|
-
t.integer "address_id"
|
392
|
-
t.string "state"
|
393
|
-
end
|
394
|
-
|
395
|
-
add_index "shipments", ["number"], :name => "index_shipments_on_number"
|
396
|
-
|
397
|
-
create_table "shipping_categories", :force => true do |t|
|
398
|
-
t.string "name"
|
399
|
-
t.datetime "created_at"
|
400
|
-
t.datetime "updated_at"
|
401
|
-
end
|
402
|
-
|
403
|
-
create_table "shipping_methods", :force => true do |t|
|
404
|
-
t.integer "zone_id"
|
405
|
-
t.string "name"
|
406
|
-
t.datetime "created_at"
|
407
|
-
t.datetime "updated_at"
|
408
|
-
t.string "display_on"
|
409
|
-
end
|
410
|
-
|
411
|
-
create_table "shipping_rates", :force => true do |t|
|
412
|
-
t.integer "shipping_category_id"
|
413
|
-
t.integer "shipping_method_id"
|
414
|
-
end
|
415
|
-
|
416
|
-
create_table "state_events", :force => true do |t|
|
417
|
-
t.integer "stateful_id"
|
418
|
-
t.integer "user_id"
|
419
|
-
t.string "name"
|
420
|
-
t.datetime "created_at"
|
421
|
-
t.datetime "updated_at"
|
422
|
-
t.string "previous_state"
|
423
|
-
t.string "stateful_type"
|
424
|
-
end
|
425
|
-
|
426
|
-
create_table "states", :force => true do |t|
|
427
|
-
t.string "name"
|
428
|
-
t.string "abbr"
|
429
|
-
t.integer "country_id"
|
430
|
-
end
|
431
|
-
|
432
|
-
create_table "tax_categories", :force => true do |t|
|
433
|
-
t.string "name"
|
434
|
-
t.string "description"
|
435
|
-
t.datetime "created_at"
|
436
|
-
t.datetime "updated_at"
|
437
|
-
t.boolean "is_default", :default => false
|
438
|
-
end
|
439
|
-
|
440
|
-
create_table "tax_rates", :force => true do |t|
|
441
|
-
t.integer "zone_id"
|
442
|
-
t.decimal "amount", :precision => 8, :scale => 4
|
443
|
-
t.datetime "created_at"
|
444
|
-
t.datetime "updated_at"
|
445
|
-
t.integer "tax_category_id"
|
446
|
-
end
|
447
|
-
|
448
|
-
create_table "taxonomies", :force => true do |t|
|
449
|
-
t.string "name", :null => false
|
450
|
-
t.datetime "created_at"
|
451
|
-
t.datetime "updated_at"
|
452
|
-
end
|
453
|
-
|
454
|
-
create_table "taxons", :force => true do |t|
|
455
|
-
t.integer "taxonomy_id", :null => false
|
456
|
-
t.integer "parent_id"
|
457
|
-
t.integer "position", :default => 0
|
458
|
-
t.string "name", :null => false
|
459
|
-
t.datetime "created_at"
|
460
|
-
t.datetime "updated_at"
|
461
|
-
t.string "permalink"
|
462
|
-
t.integer "lft"
|
463
|
-
t.integer "rgt"
|
464
|
-
t.string "icon_file_name"
|
465
|
-
t.string "icon_content_type"
|
466
|
-
t.integer "icon_file_size"
|
467
|
-
t.datetime "icon_updated_at"
|
468
|
-
t.text "description"
|
469
|
-
end
|
470
|
-
|
471
|
-
add_index "taxons", ["parent_id"], :name => "index_taxons_on_parent_id"
|
472
|
-
add_index "taxons", ["permalink"], :name => "index_taxons_on_permalink"
|
473
|
-
add_index "taxons", ["taxonomy_id"], :name => "index_taxons_on_taxonomy_id"
|
474
|
-
|
475
|
-
create_table "trackers", :force => true do |t|
|
476
|
-
t.string "environment"
|
477
|
-
t.string "analytics_id"
|
478
|
-
t.boolean "active", :default => true
|
479
|
-
t.datetime "created_at"
|
480
|
-
t.datetime "updated_at"
|
481
|
-
end
|
482
|
-
|
483
|
-
create_table "transactions", :force => true do |t|
|
484
|
-
t.decimal "amount", :default => 0.0, :null => false
|
485
|
-
t.integer "txn_type"
|
486
|
-
t.string "response_code"
|
487
|
-
t.text "avs_response"
|
488
|
-
t.text "cvv_response"
|
489
|
-
t.datetime "created_at"
|
490
|
-
t.datetime "updated_at"
|
491
|
-
t.integer "original_creditcard_txn_id"
|
492
|
-
t.integer "payment_id"
|
493
|
-
t.string "type"
|
494
|
-
end
|
495
|
-
|
496
|
-
create_table "users", :force => true do |t|
|
497
|
-
t.string "email"
|
498
|
-
t.string "crypted_password", :limit => 128
|
499
|
-
t.string "salt", :limit => 128
|
500
|
-
t.string "remember_token"
|
501
|
-
t.string "remember_token_expires_at"
|
502
|
-
t.datetime "created_at"
|
503
|
-
t.datetime "updated_at"
|
504
|
-
t.string "persistence_token"
|
505
|
-
t.string "single_access_token"
|
506
|
-
t.string "perishable_token"
|
507
|
-
t.integer "login_count", :default => 0, :null => false
|
508
|
-
t.integer "failed_login_count", :default => 0, :null => false
|
509
|
-
t.datetime "last_request_at"
|
510
|
-
t.datetime "current_login_at"
|
511
|
-
t.datetime "last_login_at"
|
512
|
-
t.string "current_login_ip"
|
513
|
-
t.string "last_login_ip"
|
514
|
-
t.string "login"
|
515
|
-
t.integer "ship_address_id"
|
516
|
-
t.integer "bill_address_id"
|
517
|
-
t.string "openid_identifier"
|
518
|
-
t.string "api_key", :limit => 40
|
519
|
-
end
|
520
|
-
|
521
|
-
add_index "users", ["openid_identifier"], :name => "index_users_on_openid_identifier"
|
522
|
-
add_index "users", ["persistence_token"], :name => "index_users_on_persistence_token"
|
523
|
-
|
524
|
-
create_table "variants", :force => true do |t|
|
525
|
-
t.integer "product_id"
|
526
|
-
t.string "sku", :default => "", :null => false
|
527
|
-
t.decimal "price", :precision => 8, :scale => 2, :null => false
|
528
|
-
t.decimal "weight", :precision => 8, :scale => 2
|
529
|
-
t.decimal "height", :precision => 8, :scale => 2
|
530
|
-
t.decimal "width", :precision => 8, :scale => 2
|
531
|
-
t.decimal "depth", :precision => 8, :scale => 2
|
532
|
-
t.datetime "deleted_at"
|
533
|
-
t.boolean "is_master", :default => false
|
534
|
-
t.integer "count_on_hand", :default => 0, :null => false
|
535
|
-
t.decimal "cost_price", :precision => 8, :scale => 2
|
536
|
-
end
|
537
|
-
|
538
|
-
add_index "variants", ["product_id"], :name => "index_variants_on_product_id"
|
539
|
-
|
540
|
-
create_table "zone_members", :force => true do |t|
|
541
|
-
t.integer "zone_id"
|
542
|
-
t.integer "zoneable_id"
|
543
|
-
t.string "zoneable_type"
|
544
|
-
t.datetime "created_at"
|
545
|
-
t.datetime "updated_at"
|
546
|
-
end
|
547
|
-
|
548
|
-
create_table "zones", :force => true do |t|
|
549
|
-
t.string "name"
|
550
|
-
t.string "description"
|
551
|
-
t.datetime "created_at"
|
552
|
-
t.datetime "updated_at"
|
553
|
-
end
|
554
|
-
|
555
|
-
end
|