From 82e03978b89938219958032efb1448cc76baa181 Mon Sep 17 00:00:00 2001
From: Saumit <justsaumit@protonmail.com>
Date: Sat, 27 Sep 2025 02:14:26 +0530
Subject: Initial snapshot - OpenTelemetry demo 2.1.3 -f

---
 src/postgres/init.sql | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 src/postgres/init.sql

(limited to 'src/postgres/init.sql')

diff --git a/src/postgres/init.sql b/src/postgres/init.sql
new file mode 100644
index 0000000..82f37f2
--- /dev/null
+++ b/src/postgres/init.sql
@@ -0,0 +1,37 @@
+-- Copyright The OpenTelemetry Authors
+-- SPDX-License-Identifier: Apache-2.0
+
+CREATE USER otelu WITH PASSWORD 'otelp';
+
+
+-- Create a table
+CREATE TABLE "order" (
+    order_id TEXT PRIMARY KEY
+);
+
+CREATE TABLE shipping (
+    shipping_tracking_id TEXT PRIMARY KEY,
+    shipping_cost_currency_code TEXT NOT NULL,
+    shipping_cost_units BIGINT NOT NULL,
+    shipping_cost_nanos INT NOT NULL,
+    street_address TEXT,
+    city TEXT,
+    state TEXT,
+    country TEXT,
+    zip_code TEXT,
+    order_id TEXT NOT NULL,
+    FOREIGN KEY (order_id) REFERENCES "order"(order_id) ON DELETE CASCADE
+);
+
+CREATE TABLE orderitem (
+    item_cost_currency_code TEXT NOT NULL,
+    item_cost_units BIGINT NOT NULL,
+    item_cost_nanos INT NOT NULL,
+    product_id TEXT NOT NULL,
+    quantity INT NOT NULL,
+    order_id TEXT NOT NULL,
+    PRIMARY KEY (order_id, product_id),
+    FOREIGN KEY (order_id) REFERENCES "order"(order_id) ON DELETE CASCADE
+);
+
+GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO otelu;
-- 
cgit v1.2.3

