aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/docker/postgres_scripts
diff options
context:
space:
mode:
authorRamya Ravichandran <ramya.ravichandran5@wipro.com>2019-02-15 16:26:45 +0530
committerRamya Ravichandran <ramya.ravichandran5@wipro.com>2019-02-15 16:28:41 +0530
commit43467ecc6a1624b7fd695883c5c6c214782f6bcd (patch)
tree13d9bc07475d63fb1e29e44b7e82b33c54df09e7 /src/main/docker/postgres_scripts
parent8b5b35c5a7dfe7213e0d1ef824fc7ae5b6c82758 (diff)
Son-handler microservice seed code
Change-Id: If4000e26044fe267bdd5fae3a1b2599182423950 Issue-ID: DCAEGEN2-1219 Signed-off-by: Ramya Ravichandran<ramya.ravichandran5@wipro.com>
Diffstat (limited to 'src/main/docker/postgres_scripts')
-rw-r--r--src/main/docker/postgres_scripts/Dockerfile7
-rw-r--r--src/main/docker/postgres_scripts/createdb.sql25
-rw-r--r--src/main/docker/postgres_scripts/init_db.sh3
3 files changed, 35 insertions, 0 deletions
diff --git a/src/main/docker/postgres_scripts/Dockerfile b/src/main/docker/postgres_scripts/Dockerfile
new file mode 100644
index 0000000..9ccb016
--- /dev/null
+++ b/src/main/docker/postgres_scripts/Dockerfile
@@ -0,0 +1,7 @@
+from busybox
+
+RUN mkdir /docker-entrypoint-initdb.d
+
+ADD createdb.sql /tmp
+
+
diff --git a/src/main/docker/postgres_scripts/createdb.sql b/src/main/docker/postgres_scripts/createdb.sql
new file mode 100644
index 0000000..dc843e7
--- /dev/null
+++ b/src/main/docker/postgres_scripts/createdb.sql
@@ -0,0 +1,25 @@
+CREATE DATABASE sonh_ms;
+\c sonh_ms
+CREATE TABLE DMAAP_NOTIFICATIONS(
+ notification TEXT PRIMARY KEY NOT NULL,
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+);
+CREATE TABLE BUFFERED_NOTIFICATIONS(
+ notification TEXT PRIMARY KEY NOT NULL,
+ cluster_id TEXT NOT NULL,
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+);
+CREATE TABLE CLUSTER_DETAILS(
+ cluster_id TEXT PRIMARY KEY NOT NULL,
+ cluster_info TEXT NOT NULL,
+ child_thread_id BIGINT UNIQUE NOT NULL
+);
+CREATE TABLE CELL_INFO(
+ cell_id TEXT PRIMARY KEY NOT NULL,
+ pnf_name TEXT NOT NULL
+);
+CREATE TABLE PCI_REQUESTS(
+ transaction_id TEXT PRIMARY KEY,
+ child_thread_id BIGINT UNIQUE NOT NULL
+);
+
diff --git a/src/main/docker/postgres_scripts/init_db.sh b/src/main/docker/postgres_scripts/init_db.sh
new file mode 100644
index 0000000..cbc27a6
--- /dev/null
+++ b/src/main/docker/postgres_scripts/init_db.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+psql -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'pci_ms'" | grep -q 1 || psql -U postgres -c "CREATE DATABASE pci_ms"