mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 11:02:54 +00:00
feat: Add goose database migrations for rating_plans and esim_profiles tables
- 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_
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
-- +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;
|
||||
@@ -0,0 +1,26 @@
|
||||
-- +goose Up
|
||||
-- Create esim_profiles table
|
||||
CREATE TABLE IF NOT EXISTS esim_profiles (
|
||||
iccid TEXT PRIMARY KEY,
|
||||
eid TEXT,
|
||||
imsi TEXT,
|
||||
mcc TEXT,
|
||||
mnc TEXT,
|
||||
profile_type TEXT,
|
||||
state TEXT,
|
||||
tenant_id TEXT,
|
||||
activation_code TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Create indexes
|
||||
CREATE INDEX IF NOT EXISTS idx_esim_profiles_eid ON esim_profiles(eid);
|
||||
CREATE INDEX IF NOT EXISTS idx_esim_profiles_imsi ON esim_profiles(imsi);
|
||||
CREATE INDEX IF NOT EXISTS idx_esim_profiles_state ON esim_profiles(state);
|
||||
CREATE INDEX IF NOT EXISTS idx_esim_profiles_tenant_id ON esim_profiles(tenant_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_esim_profiles_created_at ON esim_profiles(created_at);
|
||||
|
||||
-- +goose Down
|
||||
-- Drop esim_profiles table
|
||||
DROP TABLE IF EXISTS esim_profiles CASCADE;
|
||||
Reference in New Issue
Block a user