mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-14 09:25:47 +01:00
♻️ Migrate from prisma to drizzle (#1434)
* ♻️ Migrate from prisma to drizzle * 🐛 Build issue with CalendarTile * 🚧 Temporary solution for docker container * 🐛 Drizzle not using DATABASE_URL * ♻️ Address pull request feedback * 🐛 Remove console log of env variables * 🐛 Some unit tests not working * 🐋 Revert docker tool changes * 🐛 Issue with board slug page for logged in users --------- Co-authored-by: Thomas Camlong <thomascamlong@gmail.com>
This commit is contained in:
18
src/migrate.ts
Normal file
18
src/migrate.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
// 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';
|
||||
|
||||
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