Skip to content

Commit

Permalink
馃悰 Cleanup changes, Local db:migrate script not working, CI failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Meierschlumpf committed Nov 12, 2023
1 parent 2a1f733 commit d7cdd6a
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,4 @@ HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=3 \

USER homarr

CMD ["sh", "./scripts/run.sh"]

# TEMPORARY: "db:migrate": "ts-node ./migrate.ts ../drizzle"
CMD ["sh", "./scripts/run.sh"]
5 changes: 2 additions & 3 deletions drizzle/migrate/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import dotenv from 'dotenv';
import { drizzle } from 'drizzle-orm/better-sqlite3';
import { migrate } from 'drizzle-orm/better-sqlite3/migrator';

// TODO: Remove
// const migrationsFolder = process.argv[2] ?? './drizzle';
const migrationsFolder = process.argv[2] ?? '../drizzle';

dotenv.config({ path: __dirname + '/../.env' });

Expand All @@ -15,7 +14,7 @@ const sqlite = new Database(process.env.DATABASE_URL!.replace('file:', ''));
const db = drizzle(sqlite);

const migrateDatabase = async () => {
await migrate(db, { migrationsFolder: '../drizzle' });
await migrate(db, { migrationsFolder });
};

migrateDatabase();
1 change: 1 addition & 0 deletions drizzle/migrate/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"description": "This package.json is used for the migration script the dependencies are only installed within the Dockerfile.",
"scripts": {
"db:migrate": "ts-node ./migrate.ts"
},
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test:coverage": "SKIP_ENV_VALIDATION=1 vitest run --coverage",
"docker:build": "turbo build && docker build . -t homarr:local-dev",
"docker:start": "docker run -p 7575:7575 --name homarr-development homarr:local-dev",
"db:migrate": "ts-node drizzle/migrate/migrate.ts"
"db:migrate": "dotenv ts-node drizzle/migrate/migrate.ts ./drizzle"
},
"dependencies": {
"@auth/drizzle-adapter": "^0.3.2",
Expand Down Expand Up @@ -127,6 +127,7 @@
"@vitest/coverage-c8": "^0.33.0",
"@vitest/coverage-v8": "^0.34.5",
"@vitest/ui": "^0.34.4",
"dotenv-cli": "^7.3.0",
"eslint": "^8.0.1",
"eslint-config-next": "^13.4.5",
"eslint-plugin-promise": "^6.0.0",
Expand Down Expand Up @@ -232,4 +233,4 @@
]
}
}
}
}
30 changes: 26 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4754,7 +4754,7 @@ __metadata:
languageName: node
linkType: hard

"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2":
"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3":
version: 7.0.3
resolution: "cross-spawn@npm:7.0.3"
dependencies:
Expand Down Expand Up @@ -5346,7 +5346,28 @@ __metadata:
languageName: node
linkType: hard

"dotenv@npm:^16.3.1":
"dotenv-cli@npm:^7.3.0":
version: 7.3.0
resolution: "dotenv-cli@npm:7.3.0"
dependencies:
cross-spawn: ^7.0.3
dotenv: ^16.3.0
dotenv-expand: ^10.0.0
minimist: ^1.2.6
bin:
dotenv: cli.js
checksum: bc48e9872ed451aa7633cfde0079f5e4b40837d49dca4eab947682c80f524bd1e63ec31ff69b7cf955ff969185a05a343dd5d754dd5569e4ae31f8e9a790ab1b
languageName: node
linkType: hard

"dotenv-expand@npm:^10.0.0":
version: 10.0.0
resolution: "dotenv-expand@npm:10.0.0"
checksum: 2a38b470efe0abcb1ac8490421a55e1d764dc9440fd220942bce40965074f3fb00b585f4346020cb0f0f219966ee6b4ee5023458b3e2953fe5b3214de1b314ee
languageName: node
linkType: hard

"dotenv@npm:^16.3.0, dotenv@npm:^16.3.1":
version: 16.3.1
resolution: "dotenv@npm:16.3.1"
checksum: 15d75e7279018f4bafd0ee9706593dd14455ddb71b3bcba9c52574460b7ccaf67d5cf8b2c08a5af1a9da6db36c956a04a1192b101ee102a3e0cf8817bbcf3dfd
Expand Down Expand Up @@ -7120,6 +7141,7 @@ __metadata:
dayjs: ^1.11.7
dockerode: ^3.3.2
dotenv: ^16.3.1
dotenv-cli: ^7.3.0
drizzle-kit: ^0.19.13
drizzle-orm: ^0.28.6
eslint: ^8.0.1
Expand Down Expand Up @@ -7152,7 +7174,7 @@ __metadata:
rss-parser: ^3.12.0
sabnzbd-api: ^1.5.0
sass: ^1.56.1
ts-node: ^10.9.1
ts-node: latest
turbo: ^1.10.12
typescript: 5.1.6
uuid: ^9.0.0
Expand Down Expand Up @@ -11590,7 +11612,7 @@ __metadata:
languageName: node
linkType: hard

"ts-node@npm:^10.9.1":
"ts-node@npm:latest":
version: 10.9.1
resolution: "ts-node@npm:10.9.1"
dependencies:
Expand Down

0 comments on commit d7cdd6a

Please sign in to comment.