Guest User

Untitled

a guest
May 27th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. class CreateSubscriptions < ActiveRecord::Migration
  2. def self.up
  3. create_table :subscriptions do |t|
  4. t.column :keyword_num, :integer
  5. t.column :user_id, :integer
  6. t.column :periodicity_pairing_id, :integer
  7. t.column :amount, :string
  8. t.column :last_billed_on, :date
  9. t.timestamps
  10. end
  11. end
  12.  
  13. def self.down
  14. drop_table :subscriptions
  15. end
  16. end
  17.  
  18.  
  19. class CreatePlans < ActiveRecord::Migration
  20. def self.up
  21. create_table :plans do |t|
  22. t.column :name, :string
  23. t.column :description, :text
  24. t.timestamps
  25. end
  26. end
  27.  
  28. def self.down
  29. drop_table :plans
  30. end
  31. end
  32.  
  33.  
  34. class CreatePeriodicities < ActiveRecord::Migration
  35. def self.up
  36. create_table :periodicities do |t|
  37. t.column :length_in_days, :integer
  38. t.timestamps
  39. end
  40. end
  41.  
  42. def self.down
  43. drop_table :periodicities
  44. end
  45. end
  46.  
  47.  
  48. class CreatePeriodicityPlanPairings < ActiveRecord::Migration
  49. def self.up
  50. create_table :periodicity_plan_pairings do |t|
  51. t.column :plan_id, :integer
  52. t.column :periodicity_id, :integer
  53. t.decimal :price, :null => :no, :default => 0.0, :precision => 10, :scale => 2
  54. t.timestamps
  55. end
  56. end
  57.  
  58. def self.down
  59. drop_table :periodicity_plan_pairings
  60. end
  61. end
  62.  
  63.  
  64. class AddserviceFeeAndSurchargeToSubscriptions < ActiveRecord::Migration
  65. def self.up
  66. add_column :subscriptions, :service_fee, :decimal, :null => :no, :default => 2.95, :precision => 10, :scale => 2
  67. add_column :subscriptions, :surcharge, :decimal, :null => :no, :default => 1.95, :precision => 10, :scale => 2
  68. end
  69.  
  70. def self.down
  71. end
  72. end
Add Comment
Please, Sign In to add comment