feat: Add promotion code functionality to ticket orders
This commit is contained in:
16
db/migrate/20250928180837_create_promotion_codes.rb
Normal file
16
db/migrate/20250928180837_create_promotion_codes.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class CreatePromotionCodes < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :promotion_codes do |t|
|
||||
t.string :code, null: false, unique: true
|
||||
t.integer :discount_amount_cents, null: false, default: 0
|
||||
t.datetime :expires_at
|
||||
t.boolean :active, default: true, null: false
|
||||
t.integer :usage_limit, default: nil
|
||||
t.integer :uses_count, default: 0, null: false
|
||||
t.datetime :created_at, null: false
|
||||
t.datetime :updated_at, null: false
|
||||
end
|
||||
|
||||
add_index :promotion_codes, :code, unique: true
|
||||
end
|
||||
end
|
||||
10
db/migrate/20250928181311_create_order_promotion_codes.rb
Normal file
10
db/migrate/20250928181311_create_order_promotion_codes.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class CreateOrderPromotionCodes < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :order_promotion_codes do |t|
|
||||
t.references :order, null: false, foreign_key: true
|
||||
t.references :promotion_code, null: false, foreign_key: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user