-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
80 lines (72 loc) · 2.11 KB
/
docker-compose.yml
File metadata and controls
80 lines (72 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
services:
pgconsole:
image: pgplex/pgconsole
ports:
- "9876:9876"
configs:
- source: pgconsole_config
target: /etc/pgconsole.toml
depends_on:
postgres:
condition: service_healthy
postgres:
image: postgres:18
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 2s
timeout: 5s
retries: 5
configs:
- source: sample_db
target: /docker-entrypoint-initdb.d/init.sql
configs:
pgconsole_config:
content: |
[[connections]]
id = "local"
name = "Local PostgreSQL"
host = "postgres"
port = 5432
database = "postgres"
username = "postgres"
password = "postgres"
sample_db:
content: |
CREATE TABLE customers (
id serial PRIMARY KEY,
name varchar(100) NOT NULL,
email varchar(100) UNIQUE NOT NULL,
created_at timestamptz DEFAULT now()
);
CREATE TABLE orders (
id serial PRIMARY KEY,
customer_id int REFERENCES customers(id),
total numeric(10,2) NOT NULL,
status varchar(20) DEFAULT 'pending',
created_at timestamptz DEFAULT now()
);
CREATE TABLE order_items (
id serial PRIMARY KEY,
order_id int REFERENCES orders(id),
product varchar(100) NOT NULL,
quantity int NOT NULL,
price numeric(10,2) NOT NULL
);
INSERT INTO customers (name, email) VALUES
('Alice Johnson', 'alice@example.com'),
('Bob Smith', 'bob@example.com'),
('Carol Williams', 'carol@example.com');
INSERT INTO orders (customer_id, total, status) VALUES
(1, 299.99, 'completed'),
(1, 149.50, 'shipped'),
(2, 89.00, 'pending'),
(3, 450.00, 'completed');
INSERT INTO order_items (order_id, product, quantity, price) VALUES
(1, 'Mechanical Keyboard', 1, 199.99),
(1, 'USB-C Cable', 2, 49.99),
(2, 'Wireless Mouse', 1, 149.50),
(3, 'Laptop Stand', 1, 89.00),
(4, 'Monitor', 1, 450.00);