mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 02:52:53 +00:00
- Create 00001_init_rating_plans.sql migration with rating_plans table schema - Add plan_id, name, rate fields (data/voice/sms), monthly_fee, and limit fields (data/voice/sms) - Include is_active flag and timestamp fields (created_at, updated_at) - Add indexes on is_active and created_at columns - Create 00002_init_esim_profiles.sql migration with esim_profiles table schema - Add iccid (primary key), eid, imsi, mcc, mnc, profile_
25 lines
856 B
SQL
25 lines
856 B
SQL
-- +goose Up
|
|
-- Create rating_plans table
|
|
CREATE TABLE IF NOT EXISTS rating_plans (
|
|
plan_id TEXT PRIMARY KEY,
|
|
name TEXT NOT NULL,
|
|
data_rate DOUBLE PRECISION NOT NULL,
|
|
voice_rate DOUBLE PRECISION NOT NULL,
|
|
sms_rate DOUBLE PRECISION NOT NULL,
|
|
monthly_fee DOUBLE PRECISION NOT NULL,
|
|
data_limit BIGINT NOT NULL,
|
|
voice_limit BIGINT NOT NULL,
|
|
sms_limit BIGINT NOT NULL,
|
|
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
-- Create indexes
|
|
CREATE INDEX IF NOT EXISTS idx_rating_plans_is_active ON rating_plans(is_active);
|
|
CREATE INDEX IF NOT EXISTS idx_rating_plans_created_at ON rating_plans(created_at);
|
|
|
|
-- +goose Down
|
|
-- Drop rating_plans table
|
|
DROP TABLE IF EXISTS rating_plans CASCADE;
|