spree_flat_in_range 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +26 -0
- data/README.md +39 -0
- data/app/models/spree/calculator/flat_in_range.rb +21 -0
- data/config/locales/en.yml +5 -0
- data/lib/spree_flat_in_range.rb +21 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/admin/all.js +10 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/javascripts/store/all.js +10 -0
- data/spec/dummy/app/assets/stylesheets/admin/all.css +11 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/assets/stylesheets/store/all.css +11 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +60 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/database.yml +18 -0
- data/spec/dummy/config/environment.rb +7 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +60 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/spree.rb +12 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/spree.yml +2 -0
- data/spec/dummy/db/dummy_test +0 -0
- data/spec/dummy/db/migrate/20120218160357_spree_zero_nine_zero.rb +389 -0
- data/spec/dummy/db/migrate/20120218160358_create_indexes_for_inventory_units.rb +6 -0
- data/spec/dummy/db/migrate/20120218160359_add_count_on_hand_to_variants_and_products.rb +49 -0
- data/spec/dummy/db/migrate/20120218160360_change_taxons_to_nested_set.rb +46 -0
- data/spec/dummy/db/migrate/20120218160361_move_to_configurable_gateways.rb +54 -0
- data/spec/dummy/db/migrate/20120218160362_product_groups_and_scopes.rb +18 -0
- data/spec/dummy/db/migrate/20120218160363_add_open_id_authentication_tables.rb +15 -0
- data/spec/dummy/db/migrate/20120218160364_add_openid_field_to_users.rb +24 -0
- data/spec/dummy/db/migrate/20120218160365_change_preference_value_type.rb +10 -0
- data/spec/dummy/db/migrate/20120218160366_create_billing_integrations.rb +12 -0
- data/spec/dummy/db/migrate/20120218160367_charge_refactoring.rb +39 -0
- data/spec/dummy/db/migrate/20120218160368_add_some_indexes.rb +11 -0
- data/spec/dummy/db/migrate/20120218160369_checkout_state_machine.rb +5 -0
- data/spec/dummy/db/migrate/20120218160370_state_for_shipments.rb +5 -0
- data/spec/dummy/db/migrate/20120218160371_make_state_events_polymorphic.rb +12 -0
- data/spec/dummy/db/migrate/20120218160372_ship_address_id_for_checkouts.rb +5 -0
- data/spec/dummy/db/migrate/20120218160373_shipping_method_id_for_checkouts.rb +5 -0
- data/spec/dummy/db/migrate/20120218160374_creditcard_last_four_digits.rb +14 -0
- data/spec/dummy/db/migrate/20120218160375_populate_legacy_shipment_state.rb +15 -0
- data/spec/dummy/db/migrate/20120218160376_add_cost_price.rb +5 -0
- data/spec/dummy/db/migrate/20120218160377_shipment_id_for_inventory_units.rb +25 -0
- data/spec/dummy/db/migrate/20120218160378_cim_fields_for_creditcards.rb +6 -0
- data/spec/dummy/db/migrate/20120218160379_create_return_authorizations.rb +12 -0
- data/spec/dummy/db/migrate/20120218160380_add_return_authorization_to_inventory_units.rb +5 -0
- data/spec/dummy/db/migrate/20120218160381_create_trackers.rb +10 -0
- data/spec/dummy/db/migrate/20120218160382_creditcard_id_for_creditcard_txns.rb +5 -0
- data/spec/dummy/db/migrate/20120218160383_original_creditcard_txn_id_for_creditcard_txns.rb +5 -0
- data/spec/dummy/db/migrate/20120218160384_add_test_mode_to_billing_integration.rb +6 -0
- data/spec/dummy/db/migrate/20120218160385_create_products_product_groups.rb +8 -0
- data/spec/dummy/db/migrate/20120218160386_create_payment_methods.rb +16 -0
- data/spec/dummy/db/migrate/20120218160387_polymorphic_payments.rb +42 -0
- data/spec/dummy/db/migrate/20120218160388_change_payments_payment_method_to_belongs_to.rb +11 -0
- data/spec/dummy/db/migrate/20120218160389_assign_creditcard_txns_to_payment.rb +23 -0
- data/spec/dummy/db/migrate/20120218160390_sti_for_transactions.rb +15 -0
- data/spec/dummy/db/migrate/20120218160391_drop_billing_integrations.rb +16 -0
- data/spec/dummy/db/migrate/20120218160392_deleted_at_for_payment_methods.rb +14 -0
- data/spec/dummy/db/migrate/20120218160393_add_adjustments_index.rb +6 -0
- data/spec/dummy/db/migrate/20120218160394_fix_by_popularity.rb +9 -0
- data/spec/dummy/db/migrate/20120218160395_add_alt_text_to_images.rb +5 -0
- data/spec/dummy/db/migrate/20120218160396_fix_existing_coupon_credits.rb +13 -0
- data/spec/dummy/db/migrate/20120218160397_add_display_to_payment_methods.rb +5 -0
- data/spec/dummy/db/migrate/20120218160398_add_addresses_checkouts_indexes.rb +8 -0
- data/spec/dummy/db/migrate/20120218160399_add_icon_to_taxons.rb +17 -0
- data/spec/dummy/db/migrate/20120218160400_add_description_to_taxons.rb +11 -0
- data/spec/dummy/db/migrate/20120218160401_index_for_shipments_number.rb +5 -0
- data/spec/dummy/db/migrate/20120218160402_add_index_on_users_persistence_token.rb +5 -0
- data/spec/dummy/db/migrate/20120218160403_add_default_to_tax_categories.rb +5 -0
- data/spec/dummy/db/migrate/20120218160404_add_display_to_shipping_methods.rb +5 -0
- data/spec/dummy/db/migrate/20120218160405_rename_payment_method_display.rb +5 -0
- data/spec/dummy/db/migrate/20120218160406_rename_preferences_field.rb +5 -0
- data/spec/dummy/db/migrate/20120218160407_add_guest_flag.rb +5 -0
- data/spec/dummy/db/migrate/20120218160408_drop_order_token.rb +9 -0
- data/spec/dummy/db/migrate/20120218160409_payments_state_and_assigned_to_order_only.rb +14 -0
- data/spec/dummy/db/migrate/20120218160410_create_address_keys_for_order.rb +6 -0
- data/spec/dummy/db/migrate/20120218160411_payment_total_for_orders.rb +5 -0
- data/spec/dummy/db/migrate/20120218160412_shipping_method_id_for_orders.rb +5 -0
- data/spec/dummy/db/migrate/20120218160413_add_shipment_and_payment_state.rb +6 -0
- data/spec/dummy/db/migrate/20120218160414_refactor_adjustments.rb +29 -0
- data/spec/dummy/db/migrate/20120218160415_response_code_and_avs_response_for_payments.rb +6 -0
- data/spec/dummy/db/migrate/20120218160416_change_guest_flag_to_anonymous.rb +5 -0
- data/spec/dummy/db/migrate/20120218160417_email_for_orders.rb +5 -0
- data/spec/dummy/db/migrate/20120218160418_create_mail_methods.rb +10 -0
- data/spec/dummy/db/migrate/20120218160419_rename_frozen_to_locked.rb +5 -0
- data/spec/dummy/db/migrate/20120218160420_move_special_instructions_to_orders.rb +10 -0
- data/spec/dummy/db/migrate/20120218160421_create_log_entries.rb +11 -0
- data/spec/dummy/db/migrate/20120218160422_migrate_transactions_to_payment_state.rb +98 -0
- data/spec/dummy/db/migrate/20120218160423_delete_in_progress_orders.rb +19 -0
- data/spec/dummy/db/migrate/20120218160424_migrate_checkout_to_orders.rb +23 -0
- data/spec/dummy/db/migrate/20120218160425_remove_shipped_state.rb +12 -0
- data/spec/dummy/db/migrate/20120218160426_prevent_nil_payment_total.rb +8 -0
- data/spec/dummy/db/migrate/20120218160427_prevent_nil_email.rb +9 -0
- data/spec/dummy/db/migrate/20120218160428_generate_anonymous_users.rb +20 -0
- data/spec/dummy/db/migrate/20120218160429_update_order_state.rb +12 -0
- data/spec/dummy/db/migrate/20120218160430_cleanup_legacy_tables.rb +11 -0
- data/spec/dummy/db/migrate/20120218160431_remove_number_and_cvv_from_credicard.rb +11 -0
- data/spec/dummy/db/migrate/20120218160432_drop_anonymous_field_for_user.rb +9 -0
- data/spec/dummy/db/migrate/20120218160433_renamed_rma_cancelled_state.rb +9 -0
- data/spec/dummy/db/migrate/20120218160434_fix_problematic_index_names.rb +13 -0
- data/spec/dummy/db/migrate/20120218160435_add_position_to_variants.rb +5 -0
- data/spec/dummy/db/migrate/20120218160436_add_next_state_to_state_events.rb +5 -0
- data/spec/dummy/db/migrate/20120218160437_add_position_to_option_types.rb +5 -0
- data/spec/dummy/db/migrate/20120218160438_remove_trailing_slashes_in_taxon_permalinks.rb +19 -0
- data/spec/dummy/db/migrate/20120218160439_create_activators.rb +14 -0
- data/spec/dummy/db/migrate/20120218160440_eligible_for_adjustments.rb +5 -0
- data/spec/dummy/db/migrate/20120218160441_namespace_top_level_models.rb +52 -0
- data/spec/dummy/db/migrate/20120218160442_migrate_namespaced_polymorphic_models.rb +52 -0
- data/spec/dummy/db/migrate/20120218160443_make_adjustments_polymorphic.rb +9 -0
- data/spec/dummy/db/migrate/20120218160444_add_company_to_addresses.rb +5 -0
- data/spec/dummy/db/migrate/20120218160445_add_inc_tax_to_tax_rates.rb +5 -0
- data/spec/dummy/db/migrate/20120218160446_rename_inc_price_attribute.rb +5 -0
- data/spec/dummy/db/migrate/20120218160447_add_default_tax_zone.rb +5 -0
- data/spec/dummy/db/migrate/20120218160448_associate_shipping_methods_and_shipping_categories.rb +7 -0
- data/spec/dummy/db/migrate/20120218160449_add_match_rules_to_shipping_methods.rb +7 -0
- data/spec/dummy/db/migrate/20120218160450_new_preferences.rb +48 -0
- data/spec/dummy/db/migrate/20120218160451_add_deleted_at_to_tax_category.rb +5 -0
- data/spec/dummy/db/schema.rb +553 -0
- data/spec/dummy/db/seeds.rb +11 -0
- data/spec/dummy/log/test.log +1136 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/spec/dummy/script/rails +6 -0
- data/spec/flat_in_range_spec.rb +56 -0
- data/spec/spec_helper.rb +32 -0
- metadata +428 -0
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
Dummy::Application.config.secret_token = 'ef05d3fb2974c1df6ffc50c780064f9b5254c75df47b1e72a2f0a8fd7bff4d67271ac5c5cdc84fa3ddc54b8b3b8e415dd51fd02b72ba90b72cd3c4463b48446c'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# Dummy::Application.config.session_store :active_record_store
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Configure Spree Preferences
|
2
|
+
#
|
3
|
+
# Note: Initializing preferences available within the Admin will overwrite any changes that were made through the user interface when you restart.
|
4
|
+
# If you would like users to be able to update a setting with the Admin it should NOT be set here.
|
5
|
+
#
|
6
|
+
# In order to initialize a setting do:
|
7
|
+
# config.setting_name = 'new value'
|
8
|
+
Spree.config do |config|
|
9
|
+
# Example:
|
10
|
+
# Uncomment to override the default site name.
|
11
|
+
# config.site_name = "Spree Demo Site"
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters :format => [:json]
|
9
|
+
end
|
10
|
+
|
11
|
+
# Disable root element in JSON by default.
|
12
|
+
ActiveSupport.on_load(:active_record) do
|
13
|
+
self.include_root_in_json = false
|
14
|
+
end
|
Binary file
|
@@ -0,0 +1,389 @@
|
|
1
|
+
class SpreeZeroNineZero < ActiveRecord::Migration
|
2
|
+
# This is a legacy migration consolidating all of the database changes needed as of Spree 0.9.0
|
3
|
+
# (See http://railsdog.lighthouseapp.com/projects/31096-spree/tickets/772)
|
4
|
+
|
5
|
+
def change
|
6
|
+
create_table :addresses, :force => true do |t|
|
7
|
+
t.string :firstname, :lastname, :address1, :address2, :city,
|
8
|
+
:zipcode, :phone, :state_name, :alternative_phone
|
9
|
+
t.references :state
|
10
|
+
t.references :country
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
create_table :adjustments, :force => true do |t|
|
16
|
+
t.integer :position, :adjustment_source_id
|
17
|
+
t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
18
|
+
t.string :type, :description, :adjustment_source_type, :secondary_type
|
19
|
+
t.references :order
|
20
|
+
|
21
|
+
t.timestamps
|
22
|
+
end
|
23
|
+
|
24
|
+
create_table :assets, :force => true do |t|
|
25
|
+
t.integer :viewable_id, :attachment_width, :attachment_height,
|
26
|
+
:attachment_size, :position
|
27
|
+
t.string :viewable_type, :limit => 50
|
28
|
+
t.string :attachment_content_type, :attachment_file_name
|
29
|
+
t.string :type, :limit => 75
|
30
|
+
t.datetime :attachment_updated_at
|
31
|
+
end
|
32
|
+
|
33
|
+
create_table :calculators, :force => true do |t|
|
34
|
+
t.string :type
|
35
|
+
t.integer :calculable_id, :null => false
|
36
|
+
t.string :calculable_type, :null => false
|
37
|
+
|
38
|
+
t.timestamps
|
39
|
+
end
|
40
|
+
|
41
|
+
create_table :checkouts, :force => true do |t|
|
42
|
+
t.references :order
|
43
|
+
t.string :email, :ip_address
|
44
|
+
t.text :special_instructions
|
45
|
+
t.integer :bill_address_id
|
46
|
+
t.datetime :completed_at
|
47
|
+
|
48
|
+
t.timestamps
|
49
|
+
end
|
50
|
+
|
51
|
+
create_table :configurations, :force => true do |t|
|
52
|
+
t.string :name
|
53
|
+
t.string :type, :limit => 50
|
54
|
+
|
55
|
+
t.timestamps
|
56
|
+
end
|
57
|
+
|
58
|
+
add_index :configurations, [:name, :type], :name => 'index_configurations_on_name_and_type'
|
59
|
+
|
60
|
+
create_table :countries, :force => true do |t|
|
61
|
+
t.string :iso_name, :iso, :iso3, :name
|
62
|
+
t.integer :numcode
|
63
|
+
end
|
64
|
+
|
65
|
+
create_table :coupons, :force => true do |t|
|
66
|
+
t.string :code, :description
|
67
|
+
t.integer :usage_limit
|
68
|
+
t.boolean :combine
|
69
|
+
t.datetime :expires_at, :starts_at
|
70
|
+
|
71
|
+
t.timestamps
|
72
|
+
end
|
73
|
+
|
74
|
+
create_table :creditcard_txns, :force => true do |t|
|
75
|
+
t.integer :creditcard_payment_id, :txn_type
|
76
|
+
t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
77
|
+
t.string :response_code
|
78
|
+
t.text :avs_response, :cvv_response
|
79
|
+
|
80
|
+
t.timestamps
|
81
|
+
end
|
82
|
+
|
83
|
+
create_table :creditcards, :force => true do |t|
|
84
|
+
t.text :number, :verification_value
|
85
|
+
t.string :month, :year, :cc_type, :display_number, :first_name,
|
86
|
+
:last_name, :start_month, :start_year, :issue_number
|
87
|
+
t.references :address
|
88
|
+
t.references :checkout
|
89
|
+
|
90
|
+
t.timestamps
|
91
|
+
end
|
92
|
+
|
93
|
+
create_table :gateway_configurations, :force => true do |t|
|
94
|
+
t.references :gateway
|
95
|
+
|
96
|
+
t.timestamps
|
97
|
+
end
|
98
|
+
|
99
|
+
create_table :gateway_option_values, :force => true do |t|
|
100
|
+
t.references :gateway_configuration
|
101
|
+
t.references :gateway_option
|
102
|
+
t.text :value
|
103
|
+
|
104
|
+
t.timestamps
|
105
|
+
end
|
106
|
+
|
107
|
+
create_table :gateway_options, :force => true do |t|
|
108
|
+
t.string :name
|
109
|
+
t.text :description
|
110
|
+
t.boolean :textarea, :default => false
|
111
|
+
t.references :gateway
|
112
|
+
|
113
|
+
t.timestamps
|
114
|
+
end
|
115
|
+
|
116
|
+
create_table :gateways, :force => true do |t|
|
117
|
+
t.string :clazz, :name
|
118
|
+
t.text :description
|
119
|
+
t.boolean :active
|
120
|
+
|
121
|
+
t.timestamps
|
122
|
+
end
|
123
|
+
|
124
|
+
create_table :inventory_units, :force => true do |t|
|
125
|
+
t.integer :lock_version, :default => 0
|
126
|
+
t.string :state
|
127
|
+
t.references :variant
|
128
|
+
t.references :order
|
129
|
+
|
130
|
+
t.timestamps
|
131
|
+
end
|
132
|
+
|
133
|
+
create_table :line_items, :force => true do |t|
|
134
|
+
t.references :order
|
135
|
+
t.references :variant
|
136
|
+
t.integer :quantity, :null => false
|
137
|
+
t.decimal :price, :precision => 8, :scale => 2, :null => false
|
138
|
+
|
139
|
+
t.timestamps
|
140
|
+
end
|
141
|
+
|
142
|
+
add_index :line_items, :order_id, :name => 'index_line_items_on_order_id'
|
143
|
+
add_index :line_items, :variant_id, :name => 'index_line_items_on_variant_id'
|
144
|
+
|
145
|
+
create_table :option_types, :force => true do |t|
|
146
|
+
t.string :name, :limit => 100
|
147
|
+
t.string :presentation, :limit => 100
|
148
|
+
|
149
|
+
t.timestamps
|
150
|
+
end
|
151
|
+
|
152
|
+
create_table :option_types_prototypes, :id => false, :force => true do |t|
|
153
|
+
t.references :prototype
|
154
|
+
t.references :option_type
|
155
|
+
end
|
156
|
+
|
157
|
+
create_table :option_values, :force => true do |t|
|
158
|
+
t.integer :position
|
159
|
+
t.string :name, :presentation
|
160
|
+
t.references :option_type
|
161
|
+
|
162
|
+
t.timestamps
|
163
|
+
end
|
164
|
+
|
165
|
+
create_table :option_values_variants, :id => false, :force => true do |t|
|
166
|
+
t.integer :variant_id
|
167
|
+
t.integer :option_value_id
|
168
|
+
end
|
169
|
+
|
170
|
+
add_index :option_values_variants, :variant_id, :name => 'index_option_values_variants_on_variant_id'
|
171
|
+
|
172
|
+
create_table :orders, :force => true do |t|
|
173
|
+
t.string :number, :limit => 15
|
174
|
+
t.decimal :item_total, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
175
|
+
t.decimal :total, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
176
|
+
t.string :state
|
177
|
+
t.string :token
|
178
|
+
t.decimal :adjustment_total, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
179
|
+
t.decimal :credit_total, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
180
|
+
t.references :user
|
181
|
+
|
182
|
+
t.timestamps
|
183
|
+
end
|
184
|
+
|
185
|
+
add_index :orders, :number, :name => 'index_orders_on_number'
|
186
|
+
|
187
|
+
create_table :payments, :force => true do |t|
|
188
|
+
t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false
|
189
|
+
t.string :type
|
190
|
+
t.references :order
|
191
|
+
t.references :creditcard
|
192
|
+
|
193
|
+
t.timestamps
|
194
|
+
end
|
195
|
+
|
196
|
+
create_table :preferences, :force => true do |t|
|
197
|
+
t.string :attribute, :null => false, :limit => 100
|
198
|
+
t.integer :owner_id, :null => false, :limit => 30
|
199
|
+
t.string :owner_type, :null => false, :limit => 50
|
200
|
+
t.integer :group_id
|
201
|
+
t.string :group_type, :limit => 50
|
202
|
+
t.string :value
|
203
|
+
|
204
|
+
t.timestamps
|
205
|
+
end
|
206
|
+
|
207
|
+
add_index :preferences, [:owner_id, :owner_type, :attribute, :group_id, :group_type], :name => 'index_preferences_on_owner_and_attribute_and_preference', :unique => true
|
208
|
+
|
209
|
+
create_table :product_option_types, :force => true do |t|
|
210
|
+
t.integer :position
|
211
|
+
t.references :product
|
212
|
+
t.references :option_type
|
213
|
+
|
214
|
+
t.timestamps
|
215
|
+
end
|
216
|
+
|
217
|
+
create_table :product_properties, :force => true do |t|
|
218
|
+
t.string :value
|
219
|
+
t.references :product
|
220
|
+
t.references :property
|
221
|
+
|
222
|
+
t.timestamps
|
223
|
+
end
|
224
|
+
|
225
|
+
create_table :products, :force => true do |t|
|
226
|
+
t.string :name, :default => '', :null => false
|
227
|
+
t.text :description
|
228
|
+
t.datetime :available_on, :deleted_at
|
229
|
+
t.string :permalink, :meta_description, :meta_keywords
|
230
|
+
t.references :tax_category
|
231
|
+
t.references :shipping_category
|
232
|
+
|
233
|
+
t.timestamps
|
234
|
+
end
|
235
|
+
|
236
|
+
add_index :products, :available_on, :name => 'index_products_on_available_on'
|
237
|
+
add_index :products, :deleted_at, :name => 'index_products_on_deleted_at'
|
238
|
+
add_index :products, :name, :name => 'index_products_on_name'
|
239
|
+
add_index :products, :permalink, :name => 'index_products_on_permalink'
|
240
|
+
|
241
|
+
create_table :products_taxons, :id => false, :force => true do |t|
|
242
|
+
t.references :product
|
243
|
+
t.references :taxon
|
244
|
+
end
|
245
|
+
|
246
|
+
add_index :products_taxons, :product_id, :name => 'index_products_taxons_on_product_id'
|
247
|
+
add_index :products_taxons, :taxon_id, :name => 'index_products_taxons_on_taxon_id'
|
248
|
+
|
249
|
+
create_table :properties, :force => true do |t|
|
250
|
+
t.string :name
|
251
|
+
t.string :presentation, :null => false
|
252
|
+
|
253
|
+
t.timestamps
|
254
|
+
end
|
255
|
+
|
256
|
+
create_table :properties_prototypes, :id => false, :force => true do |t|
|
257
|
+
t.references :prototype
|
258
|
+
t.references :property
|
259
|
+
end
|
260
|
+
|
261
|
+
create_table :prototypes, :force => true do |t|
|
262
|
+
t.string :name
|
263
|
+
|
264
|
+
t.timestamps
|
265
|
+
end
|
266
|
+
|
267
|
+
create_table :roles, :force => true do |t|
|
268
|
+
t.string :name
|
269
|
+
end
|
270
|
+
|
271
|
+
create_table :roles_users, :id => false, :force => true do |t|
|
272
|
+
t.references :role
|
273
|
+
t.references :user
|
274
|
+
end
|
275
|
+
|
276
|
+
add_index :roles_users, :role_id, :name => 'index_roles_users_on_role_id'
|
277
|
+
add_index :roles_users, :user_id, :name => 'index_roles_users_on_user_id'
|
278
|
+
|
279
|
+
create_table :shipments, :force => true do |t|
|
280
|
+
t.string :tracking, :number
|
281
|
+
t.decimal :cost, :precision => 8, :scale => 2
|
282
|
+
t.datetime :shipped_at
|
283
|
+
t.references :order
|
284
|
+
t.references :shipping_method
|
285
|
+
t.references :address
|
286
|
+
|
287
|
+
t.timestamps
|
288
|
+
end
|
289
|
+
|
290
|
+
create_table :shipping_categories, :force => true do |t|
|
291
|
+
t.string :name
|
292
|
+
|
293
|
+
t.timestamps
|
294
|
+
end
|
295
|
+
|
296
|
+
create_table :shipping_methods, :force => true do |t|
|
297
|
+
t.string :name
|
298
|
+
t.references :zone
|
299
|
+
|
300
|
+
t.timestamps
|
301
|
+
end
|
302
|
+
|
303
|
+
create_table :state_events, :force => true do |t|
|
304
|
+
t.string :name, :previous_state
|
305
|
+
t.references :order
|
306
|
+
t.references :user
|
307
|
+
|
308
|
+
t.timestamps
|
309
|
+
end
|
310
|
+
|
311
|
+
create_table :states, :force => true do |t|
|
312
|
+
t.string :name
|
313
|
+
t.string :abbr
|
314
|
+
t.references :country
|
315
|
+
end
|
316
|
+
|
317
|
+
create_table :tax_categories, :force => true do |t|
|
318
|
+
t.string :name, :description
|
319
|
+
|
320
|
+
t.timestamps
|
321
|
+
end
|
322
|
+
|
323
|
+
create_table :tax_rates, :force => true do |t|
|
324
|
+
t.decimal :amount, :precision => 8, :scale => 4
|
325
|
+
t.references :zone
|
326
|
+
t.references :tax_category
|
327
|
+
|
328
|
+
t.timestamps
|
329
|
+
end
|
330
|
+
|
331
|
+
create_table :taxonomies, :force => true do |t|
|
332
|
+
t.string :name, :null => false
|
333
|
+
|
334
|
+
t.timestamps
|
335
|
+
end
|
336
|
+
|
337
|
+
create_table :taxons, :force => true do |t|
|
338
|
+
t.integer :parent_id
|
339
|
+
t.integer :position, :default => 0
|
340
|
+
t.string :name, :null => false
|
341
|
+
t.string :permalink
|
342
|
+
t.references :taxonomy
|
343
|
+
|
344
|
+
t.timestamps
|
345
|
+
end
|
346
|
+
|
347
|
+
create_table :users, :force => true do |t|
|
348
|
+
t.string :crypted_password, :limit => 128, :default => '', :null => false
|
349
|
+
t.string :salt, :limit => 128, :default => '', :null => false
|
350
|
+
t.string :email, :remember_token, :remember_token_expires_at,
|
351
|
+
:persistence_token, :single_access_token, :perishable_token
|
352
|
+
t.integer :login_count, :default => 0, :null => false
|
353
|
+
t.integer :failed_login_count, :default => 0, :null => false
|
354
|
+
t.datetime :last_request_at, :current_login_at, :last_login_at
|
355
|
+
t.string :current_login_ip, :last_login_ip, :login
|
356
|
+
t.integer :ship_address_id, :bill_address_id
|
357
|
+
|
358
|
+
t.timestamps
|
359
|
+
end
|
360
|
+
|
361
|
+
create_table :variants, :force => true do |t|
|
362
|
+
t.string :sku, :default => '', :null => false
|
363
|
+
t.decimal :price, :precision => 8, :scale => 2, :null => false
|
364
|
+
t.decimal :weight, :precision => 8, :scale => 2
|
365
|
+
t.decimal :height, :precision => 8, :scale => 2
|
366
|
+
t.decimal :width, :precision => 8, :scale => 2
|
367
|
+
t.decimal :depth, :precision => 8, :scale => 2
|
368
|
+
t.datetime :deleted_at
|
369
|
+
t.boolean :is_master, :default => false
|
370
|
+
t.references :product
|
371
|
+
end
|
372
|
+
|
373
|
+
add_index :variants, :product_id, :name => 'index_variants_on_product_id'
|
374
|
+
|
375
|
+
create_table :zone_members, :force => true do |t|
|
376
|
+
t.integer :zoneable_id
|
377
|
+
t.string :zoneable_type
|
378
|
+
t.references :zone
|
379
|
+
|
380
|
+
t.timestamps
|
381
|
+
end
|
382
|
+
|
383
|
+
create_table :zones, :force => true do |t|
|
384
|
+
t.string :name, :description
|
385
|
+
|
386
|
+
t.timestamps
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end
|