mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
Compare commits
1 Commits
7091f1f296
...
v0.16.0-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba3e73d76a |
@@ -135,5 +135,5 @@ INSERT INTO `__new_volumes_table`("id", "short_id", "name", "type", "status", "l
|
|||||||
DROP TABLE `volumes_table`;--> statement-breakpoint
|
DROP TABLE `volumes_table`;--> statement-breakpoint
|
||||||
ALTER TABLE `__new_volumes_table` RENAME TO `volumes_table`;--> statement-breakpoint
|
ALTER TABLE `__new_volumes_table` RENAME TO `volumes_table`;--> statement-breakpoint
|
||||||
CREATE UNIQUE INDEX `volumes_table_short_id_unique` ON `volumes_table` (`short_id`);--> statement-breakpoint
|
CREATE UNIQUE INDEX `volumes_table_short_id_unique` ON `volumes_table` (`short_id`);--> statement-breakpoint
|
||||||
CREATE UNIQUE INDEX `volumes_table_name_unique` ON `volumes_table` (`name`);
|
CREATE UNIQUE INDEX `volumes_table_name_unique` ON `volumes_table` (`name`);--> statement-breakpoint
|
||||||
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
||||||
|
|||||||
@@ -6,11 +6,20 @@ import { migrate } from "drizzle-orm/bun-sqlite/migrator";
|
|||||||
import { DATABASE_URL } from "../core/constants";
|
import { DATABASE_URL } from "../core/constants";
|
||||||
import * as schema from "./schema";
|
import * as schema from "./schema";
|
||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
|
import { logger } from "../utils/logger";
|
||||||
|
|
||||||
await fs.mkdir(path.dirname(DATABASE_URL), { recursive: true });
|
await fs.mkdir(path.dirname(DATABASE_URL), { recursive: true });
|
||||||
|
|
||||||
const sqlite = new Database(DATABASE_URL);
|
const sqlite = new Database(DATABASE_URL);
|
||||||
export const db = drizzle({ client: sqlite, schema });
|
export const db = drizzle({
|
||||||
|
client: sqlite,
|
||||||
|
schema,
|
||||||
|
logger: {
|
||||||
|
logQuery(query, params) {
|
||||||
|
logger.debug(`[Drizzle] ${query} -- [${params.join(",")}]`);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const runDbMigrations = () => {
|
export const runDbMigrations = () => {
|
||||||
let migrationsFolder = path.join("/app", "assets", "migrations");
|
let migrationsFolder = path.join("/app", "assets", "migrations");
|
||||||
|
|||||||
Reference in New Issue
Block a user