# Database Migration with Atlas

This project uses [Atlas](https://atlasgo.io/) for database schema management and migrations.

## 📋 Prerequisites

1. **Download and Install Atlas CLI**  
   Run the following command in PowerShell or Git Bash:

   ```sh
   curl -sSf https://atlasgo.sh | sh
   ```
    Verify installation:

    ```sh
    atlas version
    ```

2. Install GORM Provider
    Run inside your Go project:

    ```sh
    go get -u ariga.io/atlas-provider-gorm
    ```

3. Create atlas.hcl configuration file
   Just create an atlas.hcl file in your project root as example given at atlas.hcl.example
4. Create migrations folder
    ```sh
    mkdir migrations
    ```
5. Usage
You can use the provided Makefile for common commands:

    Generate a migration diff
    ```sh
    make diff
    ```

    Apply migrations
    ```sh
    make apply
    ```

    Compute schema hash
    ```sh
    make hash
    ```

    If you don’t have make installed, you can run the Atlas commands directly:
    ```sh
    atlas migrate diff --env gorm
    ```
    ```sh
    atlas migrate apply --env gorm
    ```
    ```sh
    atlas migrate hash
    ```