Skip to content

Commit

Permalink
feat: 🎸 Automatic database migration
Browse files Browse the repository at this point in the history
  • Loading branch information
HighError committed Feb 29, 2024
1 parent b3d61da commit 4e30ba9
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ LAVALINK_HOSTS=
LAVALINK_PASSWORDS=
LAVALINK_SECURED=

# Database
DATABASE_URL=
# Database (Postgresql)
DATABASE_URL=postgresql://user:password@localhost:5432/db

# Disable update command on startup
# Disable update command on startup (optional)
DISABLE_UPDATE_COMMANDS=
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ All notable changes to the "**Evilbot**" repository will be documented in this f
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

---
## [**4.3.1**] - 2024-02-29

### Added
* Automatic database migration when the bot starts


## [**4.3.0**] - 2024-02-29

### Added
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ COPY --from=builder /usr/src/app/dist ./dist
COPY --from=builder /usr/src/app/.husky ./.husky
COPY --from=builder /usr/src/app/package.json ./package.json
COPY --from=builder /usr/src/app/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder --chmod 755 /usr/src/app/start.sh ./start.sh

RUN npm install -g pnpm && pnpm install

CMD ["pnpm", "start"]
CMD /usr/src/app/start.sh
24 changes: 20 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
version: "3.8"
version: '3.8'
services:
evilbot:
image: higherror/evilbot
environment:
- BOT_TOKEN=""
- CLIENT_ID=""
- GUILD_ID=""
# Bot settings
- BOT_TOKEN=
- CLIENT_ID=

# Spotify
- SPOTIFY_CLIENT_ID=
- SPOTIFY_CLIENT_SECRET=

# Lavalink
- LAVALINK_NAMES=
- LAVALINK_HOSTS=
- LAVALINK_PASSWORDS=
- LAVALINK_SECURED=

# Database (Postgresql)
- DATABASE_URL=postgresql://user:password@localhost:5432/db

# Disable update command on startup (optional)
- DISABLE_UPDATE_COMMANDS=false
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"name": "@eviloma/evilbot",
"description": "Official discord bot for Eviloma server",
"version": "4.3.0",
"version": "4.3.1",
"homepage": "https://github.com/Eviloma/evilbot",
"license": "MIT",
"packageManager": "[email protected]",
Expand All @@ -28,7 +28,7 @@
"format": "prettier --write .",
"prepare": "node .husky/install.mjs",
"db:generate": "drizzle-kit generate:pg --config=./src/drizzle.config.ts",
"db:migrate": "tsx ./src/migrate.mjs"
"db:migrate": "node ./dist/migrate.mjs"
},
"dependencies": {
"axios": "^1.6.7",
Expand Down
3 changes: 3 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
pnpm db:migrate
pnpm start

0 comments on commit 4e30ba9

Please sign in to comment.