-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (43 loc) · 1.76 KB
/
Makefile
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
# Check if docker-compose is available, otherwise use docker compose
DOCKER_COMPOSE := $(shell command -v docker-compose 2> /dev/null || echo "docker compose")
# Run the Docker services
run:
docker compose up --build
# Stop the Docker services
stop:
$(DOCKER_COMPOSE) down --volumes
# Clean Docker containers, images, and volumes
clean: stop
$(DOCKER_COMPOSE) down --rmi all --volumes --remove-orphans
# Clean Docker container, build and runs again
restart: stop
$(DOCKER_COMPOSE) down --rmi all --volumes --remove-orphans
docker compose build
docker compose up
# Insert data into the source database
insert-data:
$(DOCKER_COMPOSE) run --rm cdc_scripts python /app/scripts/sql/insert_data.py
# Update data in the source database
update-data:
$(DOCKER_COMPOSE) run --rm cdc_scripts python /app/scripts/sql/update_data.py
# Delete data from the source database
delete-data:
$(DOCKER_COMPOSE) run --rm cdc_scripts python /app/scripts/sql/delete_data.py
# Truncate a table from the source database
truncate:
$(DOCKER_COMPOSE) run --rm cdc_scripts python /app/scripts/sql/truncate_table.py
# Creates a table in the source database
create-table:
$(DOCKER_COMPOSE) run --rm cdc_scripts python /app/scripts/sql/create_table.py
# Drops a table from the source database
drop-table:
$(DOCKER_COMPOSE) run --rm cdc_scripts python /app/scripts/sql/drop_table.py
# Adds a column to a table from the source database
add-column:
$(DOCKER_COMPOSE) run --rm cdc_scripts python /app/scripts/sql/add_column.py
# Drops a column to a table from the source database
drop-column:
$(DOCKER_COMPOSE) run --rm cdc_scripts python /app/scripts/sql/drop_column.py
# Enables CDC with pglogical for both nodes
cdc-pglogical:
$(DOCKER_COMPOSE) run --rm cdc_scripts python /app/scripts/cdc_pglogical_plugin.py