summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorBrendan Deere <brendan@stembolt.com>2016-08-25 13:06:05 -0700
committerBrendan Deere <brendan@stembolt.com>2016-08-25 13:30:33 -0700
commiteed6084719b7f3e7817e9d65b396ffb763b1fb2b (patch)
tree684b0c5bde05d75bb930f5eb11c3058ebcf67391 /db
parent0d8e4fba00f5b4a4de7e6c57df6bac489d2f7430 (diff)
Add SubscriptionLineItems
The LineItem class is responsible for associating Line items to subscriptions. It tracks the following values: [Spree::LineItem] :spree_line_item The spree object which created this instance [SolidusSubscription::Subscription] :subscription The object responsible for grouping all information needed to create new subscription orders together [Integer] :subscribable_id The id of the object to be added to new subscription orders when they are placed [Integer] :quantity How many units of the subscribable should be included in future orders [Integer] :interval How often subscription orders should be placed [Integer] :installments How many subscription orders should be placed
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20160825173548_create_solidus_subscriptions_line_items.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20160825173548_create_solidus_subscriptions_line_items.rb b/db/migrate/20160825173548_create_solidus_subscriptions_line_items.rb
new file mode 100644
index 0000000..d79408e
--- /dev/null
+++ b/db/migrate/20160825173548_create_solidus_subscriptions_line_items.rb
@@ -0,0 +1,17 @@
+class CreateSolidusSubscriptionsLineItems < ActiveRecord::Migration
+ def change
+ create_table :solidus_subscriptions_line_items do |t|
+ t.references :spree_line_item, index: true, foreign_key: true, null: false
+ t.references :subscription, index: true
+ t.integer :quantity, null: false
+ t.integer :interval, null: false
+ t.integer :installments
+ t.integer :subscribable_id, index: true, null: false
+
+ t.timestamps null: false
+ end
+
+ add_index :solidus_subscriptions_line_items, :subscription_id, name: :index_line_items_on_subscription_id
+ add_foreign_key :solidus_subscriptions_line_items, :solidus_subscriptions_subscriptions, column: :subscription_id
+ end
+end