mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 11:02:54 +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
36 lines
1.2 KiB
SQL
36 lines
1.2 KiB
SQL
-- +goose Up
|
|
-- Create notifications table
|
|
CREATE TABLE IF NOT EXISTS notifications (
|
|
id SERIAL PRIMARY KEY,
|
|
subscriber_id INTEGER NOT NULL,
|
|
type TEXT NOT NULL,
|
|
title TEXT NOT NULL,
|
|
message TEXT NOT NULL,
|
|
read BOOLEAN NOT NULL DEFAULT false,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
-- Create alerts table
|
|
CREATE TABLE IF NOT EXISTS alerts (
|
|
id SERIAL PRIMARY KEY,
|
|
type TEXT NOT NULL,
|
|
severity TEXT NOT NULL,
|
|
message TEXT NOT NULL,
|
|
subscriber_id INTEGER,
|
|
timestamp TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
resolved BOOLEAN NOT NULL DEFAULT false
|
|
);
|
|
|
|
-- Create indexes
|
|
CREATE INDEX IF NOT EXISTS idx_notifications_subscriber_id ON notifications(subscriber_id);
|
|
CREATE INDEX IF NOT EXISTS idx_notifications_read ON notifications(read);
|
|
CREATE INDEX IF NOT EXISTS idx_alerts_subscriber_id ON alerts(subscriber_id);
|
|
CREATE INDEX IF NOT EXISTS idx_alerts_type ON alerts(type);
|
|
CREATE INDEX IF NOT EXISTS idx_alerts_severity ON alerts(severity);
|
|
CREATE INDEX IF NOT EXISTS idx_alerts_resolved ON alerts(resolved);
|
|
|
|
-- +goose Down
|
|
-- Drop notifications and alerts tables
|
|
DROP TABLE IF EXISTS notifications CASCADE;
|
|
DROP TABLE IF EXISTS alerts CASCADE;
|