-- 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;