Model for subscriptions #migration

This commit is contained in:
Andrew Brown 2017-01-20 21:48:05 +00:00
parent 0434242a94
commit 1ec58d3b7b
3 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,4 @@
class Subscription < ActiveRecord::Base
belongs_to :user
belongs_to :billing_plan
end

View File

@ -0,0 +1,12 @@
class CreateSubscriptions < ActiveRecord::Migration
def change
create_table :subscriptions do |t|
t.references :user, index: true, foreign_key: true
t.references :billing_plan, index: true, foreign_key: true
t.datetime :start_date
t.datetime :end_date
t.timestamps null: false
end
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170120214443) do
ActiveRecord::Schema.define(version: 20170120214721) do
create_table "archenemyships", force: :cascade do |t|
t.integer "user_id"
@ -615,6 +615,18 @@ ActiveRecord::Schema.define(version: 20170120214443) do
t.integer "subgroup_id"
end
create_table "subscriptions", force: :cascade do |t|
t.integer "user_id"
t.integer "billing_plan_id"
t.datetime "start_date"
t.datetime "end_date"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "subscriptions", ["billing_plan_id"], name: "index_subscriptions_on_billing_plan_id"
add_index "subscriptions", ["user_id"], name: "index_subscriptions_on_user_id"
create_table "supergroupships", force: :cascade do |t|
t.integer "user_id"
t.integer "group_id"