mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-14 01:15:47 +01:00
🚧 Improve dockerfile and start script and fix permission issue by adding new user with permission to read / write to /data folder
This commit is contained in:
21
drizzle/migrate/migrate.ts
Normal file
21
drizzle/migrate/migrate.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
// This file is used to migrate the database to the current version
|
||||
// It is run when the docker container starts
|
||||
import Database from 'better-sqlite3';
|
||||
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';
|
||||
|
||||
dotenv.config({ path: __dirname + '/../.env' });
|
||||
|
||||
const sqlite = new Database(process.env.DATABASE_URL!.replace('file:', ''));
|
||||
|
||||
const db = drizzle(sqlite);
|
||||
|
||||
const migrateDatabase = async () => {
|
||||
await migrate(db, { migrationsFolder: '../drizzle' });
|
||||
};
|
||||
|
||||
migrateDatabase();
|
||||
Reference in New Issue
Block a user