feat: seed global billing settings in application_settings

This commit is contained in:
Graham McIntire 2026-03-06 13:26:50 -06:00
parent ffb61641bb
commit 7d61d8fb0a
No known key found for this signature in database

View file

@ -0,0 +1,22 @@
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', 'string',
'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