towerops/priv/repo/migrations/20260306192611_seed_billing_settings.exs

22 lines
719 B
Elixir

defmodule Towerops.Repo.Migrations.SeedBillingSettings do
use Ecto.Migration
def up do
execute """
INSERT INTO application_settings (id, key, value, value_type, description, inserted_at, updated_at)
VALUES
(gen_random_uuid(), 'default_free_devices', '10', 'integer',
'Number of free devices included in all subscriptions', NOW(), NOW()),
(gen_random_uuid(), 'default_price_per_device', '2.00', 'decimal',
'Price per device per month (USD) after free tier', NOW(), NOW())
ON CONFLICT (key) DO NOTHING;
"""
end
def down do
execute """
DELETE FROM application_settings
WHERE key IN ('default_free_devices', 'default_price_per_device');
"""
end
end