Skip to content

Commit

Permalink
add env to comands
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciabad committed Oct 25, 2023
1 parent fa3f614 commit bef2f4f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 0 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ DATABASE_LABEL=stage
DATABASE_USERNAME=toBeChanged
DATABASE_PASSWORD=toBeChanged

# Local DB
# DATABASE_LABEL=local
# USE_LOCAL_DB=true

# AWS S3 connection settings
AWS_ACCESS_KEY_ID=toBeChanged
AWS_SECRET_ACCESS_KEY=toBeChanged
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
"test:e2e:dev": "playwright test --ui",
"db:generate": "SKIP_ENV_VALIDATION=true drizzle-kit generate:mysql",
"db:push": "drizzle-kit push:mysql",
"db-local:studio": "drizzle-kit studio",
"db-local:migrate": "node ./src/server/db/migrate.mjs",
"db-local:run-app": "USE_LOCAL_DB=true next dev",
"db:studio": "drizzle-kit studio",
"db-local:studio": "USE_LOCAL_DB=true drizzle-kit studio",
"db-local:migrate": "USE_LOCAL_DB=true node ./src/server/db/migrate.mjs",
"db-local:run-app": "USE_LOCAL_DB=true DATABASE_LABEL=local next dev",
"db-local:run-db": "docker run --name descobreix-begur-app-database -e MYSQL_ROOT_PASSWORD=unsafePaswordOnlyForLocalhost -e MYSQL_DATABASE=descobreix-begur-app -p 3306:3306 mysql"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions src/server/db/migrate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import { migrate } from 'drizzle-orm/mysql2/migrator'
import { drizzle as drizzleMysql } from 'drizzle-orm/mysql2'
import { createConnection } from 'mysql2'
import { env } from '../../env.mjs'

if (env.USE_LOCAL_DB !== 'true') {
if (process.env.USE_LOCAL_DB !== 'true') {
throw new Error(
'Migrations are only allowed on local database. (this is a custom error)'
)
Expand Down

0 comments on commit bef2f4f

Please sign in to comment.