mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 02:52:53 +00:00
- Add subscribers table with IMSI, MSISDN, authentication keys, and eSIM profile fields - Add service_plans table for data/voice/SMS limits and QoS parameters (ARPA, AMBR) - Add sessions table for tracking PDU sessions with QoS and usage metrics - Add usage_records table for billing and charging data - Add users table with role-based access control fields - Add roles, permissions, and role_permissions junction table for RBAC - Add auth
26 lines
945 B
SQL
26 lines
945 B
SQL
-- +goose Up
|
|
-- Create transactions table
|
|
CREATE TABLE IF NOT EXISTS transactions (
|
|
id SERIAL PRIMARY KEY,
|
|
subscriber_id INTEGER NOT NULL,
|
|
transaction_id TEXT NOT NULL,
|
|
type TEXT NOT NULL,
|
|
amount DOUBLE PRECISION NOT NULL,
|
|
currency TEXT NOT NULL,
|
|
status TEXT NOT NULL,
|
|
description TEXT,
|
|
parent_id INTEGER,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
-- Create indexes
|
|
CREATE INDEX IF NOT EXISTS idx_transactions_subscriber_id ON transactions(subscriber_id);
|
|
CREATE INDEX IF NOT EXISTS idx_transactions_transaction_id ON transactions(transaction_id);
|
|
CREATE INDEX IF NOT EXISTS idx_transactions_status ON transactions(status);
|
|
CREATE INDEX IF NOT EXISTS idx_transactions_created_at ON transactions(created_at);
|
|
|
|
-- +goose Down
|
|
-- Drop transactions table
|
|
DROP TABLE IF EXISTS transactions CASCADE;
|