Compare commits

...

2 Commits

Author SHA1 Message Date
Nicolas Meienberger
4328607cc1 fix: skip renaming imported repository 2025-11-26 22:20:42 +01:00
Nicolas Meienberger
bedd325a60 fix(db): set pragma after migrations 2025-11-26 20:12:12 +01:00
3 changed files with 16 additions and 2 deletions

View File

@@ -10,8 +10,6 @@ import fs from "node:fs/promises";
await fs.mkdir(path.dirname(DATABASE_URL), { recursive: true });
const sqlite = new Database(DATABASE_URL);
sqlite.run("PRAGMA foreign_keys = ON;");
export const db = drizzle({ client: sqlite, schema });
export const runDbMigrations = () => {
@@ -23,4 +21,6 @@ export const runDbMigrations = () => {
}
migrate(db, { migrationsFolder });
sqlite.run("PRAGMA foreign_keys = ON;");
};

View File

@@ -99,6 +99,11 @@ const migrateRepositoryFolders = async (): Promise<MigrationResult> => {
const config = repo.config as Extract<RepositoryConfig, { backend: "local" }>;
if (config.isExistingRepository) {
logger.debug(`Skipping imported repository "${repo.name}" - folder path is user-defined`);
continue;
}
if (config.name === repo.shortId) {
continue;
}

View File

@@ -367,6 +367,15 @@ const updateRepository = async (name: string, updates: { name?: string; compress
throw new NotFoundError("Repository not found");
}
if (
updates.name !== undefined &&
updates.name !== existing.name &&
existing.config.backend === "local" &&
existing.config.isExistingRepository
) {
throw new ConflictError("Cannot rename an imported local repository");
}
let newName = existing.name;
if (updates.name !== undefined && updates.name !== existing.name) {
const newSlug = slugify(updates.name, { lower: true, strict: true });