DEV Community

Pranav Bakare
Pranav Bakare

Posted on

Merging and Deployment process with respect to SQL scripts

Let's break this down step by step to clear up the confusion. You're absolutely right that there's a process to follow, and I can see where the confusion might arise.

Here's a clearer explanation:

  1. Understanding the Feature Branch:

You create a feature branch to work on a specific task or feature. For example, you might create a branch like feature/database-changes where you'll work on adding new SQL scripts, schema changes, migrations, or database fixes.

Example:

git checkout -b feature/database-changes

  1. Working with the DAB Folder:

Inside your feature branch (feature/database-changes), you'll modify or add your SQL scripts (or other database-related files) to the DAB folder.

The DAB folder is just a regular folder within your feature branch, and it holds database-related artifacts (like SQL files, schema changes, etc.).

Example structure:

feature/database-changes/
├── DAB/
│ ├── schema_updates.sql
│ └── migration_v1.sql
└── other_code_files/
└── app_code.py

  1. Committing Changes to the Feature Branch:

After adding or modifying files in the DAB folder (and any other files you are working on), you commit your changes to your feature branch.

Example:

git add .
git commit -m "Added database changes to DAB folder"

  1. Create a Merge Request (MR) for Review:

After you've committed your changes, you create a Merge Request (MR) (or Pull Request, PR) to merge your feature branch into the main branch (or the branch you’re targeting for integration, like develop).

This MR will include the changes in the DAB folder as well, which are now part of your feature branch.

  1. Merging the MR:

Once the MR is reviewed and approved, it gets merged into the main branch (e.g., main or develop).

  1. Jenkins Pipeline Execution:

After the MR is merged into the main branch, the Jenkins pipeline is triggered automatically (assuming it's configured to run on merges to the main branch).

The pipeline picks up the changes in the DAB folder from the merged code.

Jenkins will then execute the SQL scripts inside the DAB folder (like schema updates, migrations, etc.) in the correct order as specified in your pipeline.

The Key Point: The DAB Folder Comes into Play When You Commit It in the Feature Branch.

The DAB folder will be part of your feature branch from the beginning, and when you create the MR, the DAB folder changes will be included in the MR.

When the MR is merged, Jenkins will automatically execute the database-related tasks from the DAB folder as part of the pipeline execution.

So, you’re not directly working with the DAB folder in the main branch until your MR is merged. It's all part of your feature branch work.

Example Workflow Summary:

  1. Create Feature Branch:

git checkout -b feature/database-changes

  1. Make Changes in DAB Folder:

Add SQL scripts to DAB/ folder (e.g., DAB/schema_updates.sql).

  1. Commit and Push to Feature Branch:

git add .

git commit -m "Add database changes to DAB folder"

git push origin feature/database-changes

  1. Create a Merge Request (MR):

Create an MR to merge feature/database-changes into the main or develop branch.

  1. Jenkins Executes Pipeline After Merge:

Once merged, Jenkins pipeline runs and executes the SQL scripts from the DAB folder as part of the deployment.

The Mistake to Avoid:

Don’t place changes directly in the main branch. Always make those changes in a feature branch and include the DAB folder contents there.

The DAB folder is simply a directory within your feature branch and doesn't affect the main branch until your MR is merged.

Image of AssemblyAI tool

Transforming Interviews into Publishable Stories with AssemblyAI

Insightview is a modern web application that streamlines the interview workflow for journalists. By leveraging AssemblyAI's LeMUR and Universal-2 technology, it transforms raw interview recordings into structured, actionable content, dramatically reducing the time from recording to publication.

Key Features:
🎥 Audio/video file upload with real-time preview
🗣️ Advanced transcription with speaker identification
⭐ Automatic highlight extraction of key moments
✍️ AI-powered article draft generation
📤 Export interview's subtitles in VTT format

Read full post

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay