-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (40 loc) · 1.37 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Имя базы данных
DB_NAME=stripkun
# Push Repository to GitHub / Gitlab / GitTea
git:
git push origin && git push gitlab && git push gittea
# URL для подключения к базе данных
DB_URL=postgresql://root:root@localhost:5432/$(DB_NAME)?sslmode=disable
# Run DEV
run:
npm run dev
# Build && Run Prod
build:
npm run build && npm run start
# DB: Redis Cache
redis:
docker run --name redis7 -p 6379:6379 -d redis:7-alpine
# DB: Start Docker PostgreSQL 16
postgres:
docker run --name postgres16 -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=root -d postgres:16-alpine
# DB: Start Docker MySQL 8
mysql:
docker run --name mysql8 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:8
# DB: CREATE DATABASE
createdb:
docker exec -it postgres16 createdb --username=root --owner=root $(DB_NAME)
make migrateup
# DB: DROP DATABASE && DB: CREATE DATABASE && DB: Migration: UP
dropdb:
docker exec -it postgres16 dropdb $(DB_NAME)
make createdb
# DB: Migration: UP
migrateup:
migrate -path db/migration -database "$(DB_URL)" -verbose up
# DB: Migration: DOWN && DB: Migration: UP
migratedown:
migrate -path db/migration -database "$(DB_URL)" -verbose down
migrate -path db/migration -database "$(DB_URL)" -verbose up
migratefix:
migrate -path db/migration -database "$(DB_URL)" -verbose force 1
.PHONY: migrateup migratedown run createdb dropdb