Files
Munawwirul Jamal 87baa898f6 dev: hotfixes
+ moved cmd/simgos-sync* to cmd/snync*
+ adjust Dockerfiles
2025-12-12 10:51:37 +07:00

59 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 dont 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
```