Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# create ydbcp tables
./ydb -e ${YDB_ENDPOINT} -d /local scripting yql -f init_db/schema/create_tables.yql

# create and fill user table kv_test
./ydb -e ${YDB_ENDPOINT} -d /local workload kv init
./ydb -e ${YDB_ENDPOINT} -d /local workload kv run upsert --rows 100
Expand Down
27 changes: 24 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,41 @@ services:
networks:
- ydbcp-net

init_ydb_schema:
image: golang:1.23-alpine
platform: linux/amd64
container_name: ${YDB_NAME}-init-schema
volumes:
- ./migrations:/migrations
environment:
- YDB_ENDPOINT=grpc://${YDB_NAME}:2136
- YDB_DATABASE=/local
- GOOSE_YDB_PARAMS=go_query_mode=scripting&go_fake_tx=scripting&go_query_bind=declare,numeric
depends_on:
ydb:
condition: service_healthy
restart: "no"
command: >
sh -c "go install github.com/pressly/goose/v3/cmd/goose@latest &&
goose -dir /migrations/yql ydb \"$$YDB_ENDPOINT/$$YDB_DATABASE?$$GOOSE_YDB_PARAMS\" up"
networks:
- ydbcp-net

setup_ydb:
image: cr.yandex/yc/yandex-docker-local-ydb:24.1
platform: linux/amd64
container_name: ${YDB_NAME}-setup
volumes:
- ./init_db:/init_db
- ./internal/connectors/db/yql/schema:/init_db/schema
- ./cmd/integration/scripts:/scripts
environment:
- YDB_ENDPOINT=grpc://${YDB_NAME}:2136
depends_on:
ydb:
condition: service_healthy
init_ydb_schema:
condition: service_completed_successfully
restart: "no"
command: bash -c "chmod +x ./init_db/create_tables.sh && ./init_db/create_tables.sh"
command: bash -c "chmod +x ./scripts/create_test_tables.sh && ./scripts/create_test_tables.sh"
networks:
- ydbcp-net

Expand Down
3 changes: 0 additions & 3 deletions internal/connectors/db/yql/schema/drop_tables.yql

This file was deleted.

14 changes: 0 additions & 14 deletions internal/connectors/db/yql/schema/fill_tables.yql

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- +goose Up
CREATE TABLE Backups (
id String NOT NULL,
container_id String NOT NULL,
Expand Down Expand Up @@ -51,7 +52,6 @@ CREATE TABLE Operations (
status String,
message String,

root_path String,
paths String,
paths_to_exclude String,
operation_id String,
Expand Down Expand Up @@ -80,7 +80,6 @@ CREATE TABLE BackupSchedules (

crontab String NOT NULL,
ttl Interval,
root_path String,
paths String,
paths_to_exclude String,

Expand All @@ -91,4 +90,17 @@ CREATE TABLE BackupSchedules (

next_launch Timestamp,
PRIMARY KEY (id)
)
);

UPSERT INTO OperationTypes (code, description, is_cancellable) VALUES
('TB', 'Take backup', True),
('RB', 'Restore backup', True),
('DB', 'Delete backup', False),
('TBWR', 'Take backup with retries', True);

-- +goose Down
DROP TABLE BackupSchedules;
DROP TABLE Operations;
DROP TABLE OperationTypes;
DROP TABLE Backups;

14 changes: 14 additions & 0 deletions migrations/yql/20251127120000_add_root_path_columns.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- +goose Up
ALTER TABLE Operations
ADD COLUMN root_path String;

ALTER TABLE BackupSchedules
ADD COLUMN root_path String;

-- +goose Down
ALTER TABLE BackupSchedules
DROP COLUMN root_path;

ALTER TABLE Operations
DROP COLUMN root_path;

Loading