Estructura del consumidor

This commit is contained in:
2026-01-16 11:14:35 +01:00
parent 20482915de
commit b29348b88d
18 changed files with 174 additions and 61 deletions

View File

@@ -19,20 +19,6 @@ CREATE table if not exists sim_cards (
deleted_at TIMESTAMP
);
CREATE TABLE if not exists sim_operations (
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
sim_id BIGINT,
operation_type TEXT NOT NULL,
happened_at TIMESTAMP,
CONSTRAINT valid_operations CHECK (
operation_type in ('free','preactivate','activate','pause','cancel')
),
CONSTRAINT fk_sim_id
FOREIGN KEY(sim_id)
REFERENCES sim_cards(id)
);
CREATE TABLE if not exists sim_envio (
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
@@ -94,6 +80,21 @@ CREATE TABLE sim_subscription (
FOREIGN KEY(subscription_type_id) REFERENCES sim_subscription_types(id)
);
CREATE TABLE if not exists sim_subscription_operations (
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
sim_id BIGINT,
operation_type TEXT NOT NULL,
happened_at TIMESTAMP,
CONSTRAINT valid_operations CHECK (
operation_type in ('free','preactivate','activate','pause','cancel')
),
CONSTRAINT fk_subscription_id
FOREIGN KEY(subscription_id)
REFERENCES sim_subscriptions(id)
);
-- Se supone que indica un cambio
CREATE TABLE sim_subscription_historic (
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,

View File

@@ -51,7 +51,21 @@
],
"queues": [
{
"name": "sim.queue",
"name": "sim.logs",
"vhost": "sim-vhost",
"durable": true,
"auto_delete": false,
"arguments": {}
},
{
"name": "sim.activations",
"vhost": "sim-vhost",
"durable": true,
"auto_delete": false,
"arguments": {}
},
{
"name": "sim.cancelations",
"vhost": "sim-vhost",
"durable": true,
"auto_delete": false,
@@ -62,7 +76,23 @@
{
"source": "sim.exchange",
"vhost": "sim-vhost",
"destination": "sim.queue",
"destination": "sim.activations",
"destination_type": "queue",
"routing_key": "sim.activation",
"arguments": {}
},
{
"source": "sim.exchange",
"vhost": "sim-vhost",
"destination": "sim.cancelations",
"destination_type": "queue",
"routing_key": "sim.cancelation",
"arguments": {}
},
{
"source": "sim.exchange",
"vhost": "sim-vhost",
"destination": "sim.logs",
"destination_type": "queue",
"routing_key": "sim.*",
"arguments": {}