mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-06 19:46:44 +03:00
🎉 Gitea Mirror: Added
This commit is contained in:
27
src/lib/db/migrations/add-mirrored-location.ts
Normal file
27
src/lib/db/migrations/add-mirrored-location.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { client } from "@/lib/db";
|
||||
|
||||
/**
|
||||
* Migration script to add the mirrored_location column to the repositories table
|
||||
*/
|
||||
export async function addMirroredLocationColumn() {
|
||||
try {
|
||||
console.log("Starting migration: Adding mirrored_location column to repositories table");
|
||||
|
||||
// Check if the column already exists
|
||||
const tableInfo = await client.execute(`PRAGMA table_info(repositories)`);
|
||||
const columnExists = tableInfo.rows.some((row: any) => row.name === "mirrored_location");
|
||||
|
||||
if (columnExists) {
|
||||
console.log("Column mirrored_location already exists, skipping migration");
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the mirrored_location column
|
||||
await client.execute(`ALTER TABLE repositories ADD COLUMN mirrored_location TEXT DEFAULT ''`);
|
||||
|
||||
console.log("Migration completed successfully: mirrored_location column added");
|
||||
} catch (error) {
|
||||
console.error("Migration failed:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user