feat(migrations): Add promotion code migrations

This commit is contained in:
kbe
2025-09-29 11:59:48 +02:00
parent 1fc3311ca9
commit a4a427ad5c
2 changed files with 28 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
class CreatePromotionCodes < ActiveRecord::Migration[8.0]
def change
create_table :promotion_codes do |t|
t.string :code, null: false, unique: true
t.string :code, null: false
t.integer :discount_amount_cents, null: false, default: 0
t.datetime :expires_at
t.boolean :active, default: true, null: false
@@ -11,6 +11,7 @@ class CreatePromotionCodes < ActiveRecord::Migration[8.0]
t.datetime :updated_at, null: false
end
# Unique index for code
add_index :promotion_codes, :code, unique: true
end
end