From d41ceb99310ebe0a47845d005979426d7efba206 Mon Sep 17 00:00:00 2001 From: poojan644 Date: Tue, 18 Aug 2026 11:22:46 -0400 Subject: [PATCH 1/7] Add initial CI/CD pipeline for database repository --- .github/workflows/database-pipeline.yml | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/database-pipeline.yml diff --git a/.github/workflows/database-pipeline.yml b/.github/workflows/database-pipeline.yml new file mode 100644 index 0000000..7a6e8c0 --- /dev/null +++ b/.github/workflows/database-pipeline.yml @@ -0,0 +1,41 @@ +name: Database Pipeline + +on: + push: + branches: + - main + - feature/database-cicd-pipeline + + pull_request: + branches: + - main + +jobs: + validate-sql-files: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Verify repository structure + run: | + echo "Checking repository structure..." + + if [ ! -d "ddl" ]; then + echo "ddl folder not found" + exit 1 + fi + + if [ ! -d "dml" ]; then + echo "dml folder not found" + exit 1 + fi + + echo "Repository structure verified." + + - name: List DDL files + run: find ddl -name "*.sql" + + - name: List DML files + run: find dml -name "*.sql" \ No newline at end of file From 0d983467c278b649345c7803ef2c469368773707 Mon Sep 17 00:00:00 2001 From: poojan644 Date: Thu, 20 Aug 2026 14:31:24 -0400 Subject: [PATCH 2/7] ci: add SQL file content validation --- .github/workflows/database-pipeline.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/database-pipeline.yml b/.github/workflows/database-pipeline.yml index 7a6e8c0..c1cd124 100644 --- a/.github/workflows/database-pipeline.yml +++ b/.github/workflows/database-pipeline.yml @@ -38,4 +38,18 @@ jobs: run: find ddl -name "*.sql" - name: List DML files - run: find dml -name "*.sql" \ No newline at end of file + run: find dml -name "*.sql" + + - name: Check SQL files are not empty + run: | + echo "Checking SQL files..." + + empty_files=$(find ddl dml -type f -name "*.sql" -empty) + + if [ -n "$empty_files" ]; then + echo "The following SQL files are empty:" + echo "$empty_files" + exit 1 + fi + + echo "All SQL files contain content." \ No newline at end of file From f933c03ffd8dee64cc2d66dbe380047d3e6b1b6a Mon Sep 17 00:00:00 2001 From: poojan644 Date: Thu, 20 Aug 2026 14:43:10 -0400 Subject: [PATCH 3/7] test database script execution in CI --- .github/workflows/database-pipeline.yml | 35 +++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/database-pipeline.yml b/.github/workflows/database-pipeline.yml index c1cd124..eef4f80 100644 --- a/.github/workflows/database-pipeline.yml +++ b/.github/workflows/database-pipeline.yml @@ -14,6 +14,21 @@ jobs: validate-sql-files: runs-on: ubuntu-latest + services: + postgres: + image: postgres:16 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: saayam_test + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready -U postgres -d saayam_test" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -39,7 +54,7 @@ jobs: - name: List DML files run: find dml -name "*.sql" - + - name: Check SQL files are not empty run: | echo "Checking SQL files..." @@ -52,4 +67,20 @@ jobs: exit 1 fi - echo "All SQL files contain content." \ No newline at end of file + echo "All SQL files contain content." + + - name: Install PostgreSQL client + run: | + sudo apt-get update + sudo apt-get install -y postgresql-client + + - name: Test database script execution + env: + PGPASSWORD: postgres + run: | + psql \ + -h localhost \ + -U postgres \ + -d saayam_test \ + -v ON_ERROR_STOP=1 \ + -f ddl/Tables/Scripts/ireland_dev_saayam_rdbms.sql \ No newline at end of file From fb6e20157af449b200cf011c408fbcd4583643e8 Mon Sep 17 00:00:00 2001 From: poojan644 Date: Thu, 20 Aug 2026 14:47:32 -0400 Subject: [PATCH 4/7] fix database pipeline YAML structure --- .github/workflows/database-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/database-pipeline.yml b/.github/workflows/database-pipeline.yml index eef4f80..900bc01 100644 --- a/.github/workflows/database-pipeline.yml +++ b/.github/workflows/database-pipeline.yml @@ -69,7 +69,7 @@ jobs: echo "All SQL files contain content." - - name: Install PostgreSQL client + - name: Install PostgreSQL client run: | sudo apt-get update sudo apt-get install -y postgresql-client From c6fde14d1acc098857e8c0d24cd7d161883b9fb4 Mon Sep 17 00:00:00 2001 From: poojan644 Date: Thu, 20 Aug 2026 15:24:02 -0400 Subject: [PATCH 5/7] use PostGIS image for database CI --- .github/workflows/database-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/database-pipeline.yml b/.github/workflows/database-pipeline.yml index 900bc01..b05b8c3 100644 --- a/.github/workflows/database-pipeline.yml +++ b/.github/workflows/database-pipeline.yml @@ -16,7 +16,7 @@ jobs: services: postgres: - image: postgres:16 + image: postgis/postgis:16-3.4 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres From fbb36f48beaea0343c52a0b81f9d827a5c41a0bb Mon Sep 17 00:00:00 2001 From: poojan644 Date: Thu, 20 Aug 2026 15:32:07 -0400 Subject: [PATCH 6/7] Create required database role for CI --- .github/workflows/database-pipeline.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/database-pipeline.yml b/.github/workflows/database-pipeline.yml index b05b8c3..07fc6cb 100644 --- a/.github/workflows/database-pipeline.yml +++ b/.github/workflows/database-pipeline.yml @@ -74,6 +74,16 @@ jobs: sudo apt-get update sudo apt-get install -y postgresql-client + - name: Create required database role + env: + PGPASSWORD: postgres + run: | + psql \ + -h localhost \ + -U postgres \ + -d saayam_test \ + -c "CREATE ROLE dbadmin_user;" + - name: Test database script execution env: PGPASSWORD: postgres From 325b4b5af6e19c40632869b8443db4813ae68821 Mon Sep 17 00:00:00 2001 From: poojan644 Date: Thu, 20 Aug 2026 15:36:26 -0400 Subject: [PATCH 7/7] Create required database schema for CI --- .github/workflows/database-pipeline.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/database-pipeline.yml b/.github/workflows/database-pipeline.yml index 07fc6cb..6fa4870 100644 --- a/.github/workflows/database-pipeline.yml +++ b/.github/workflows/database-pipeline.yml @@ -84,6 +84,16 @@ jobs: -d saayam_test \ -c "CREATE ROLE dbadmin_user;" + - name: Create required database schema + env: + PGPASSWORD: postgres + run: | + psql \ + -h localhost \ + -U postgres \ + -d saayam_test \ + -c "CREATE SCHEMA IF NOT EXISTS ireland_dev_saayam_rdbms;" + - name: Test database script execution env: PGPASSWORD: postgres