feat: added dataPath for projects

This commit is contained in:
2026-02-12 15:00:37 +01:00
parent 2b95f3d72c
commit 85d196e598
15 changed files with 263 additions and 49 deletions

View File

@@ -401,6 +401,14 @@ export class DatabaseConnection {
console.log('Tags table created successfully');
}
// Migration: Add data_path column to projects table
const dataPathCol = await this.localClient.execute(
"SELECT name FROM pragma_table_info('projects') WHERE name = 'data_path'"
);
if (dataPathCol.rows.length === 0) {
await this.localClient.execute("ALTER TABLE projects ADD COLUMN data_path TEXT");
}
// Create default project if none exists
const existingProjects = await this.localClient.execute('SELECT COUNT(*) as count FROM projects');
if (existingProjects.rows[0] && (existingProjects.rows[0].count as number) === 0) {

View File

@@ -6,6 +6,7 @@ export const projects = sqliteTable('projects', {
name: text('name').notNull(),
slug: text('slug').notNull().unique(),
description: text('description'),
dataPath: text('data_path'), // Custom path for project data (null = default userData/projects/{id})
createdAt: integer('created_at', { mode: 'timestamp' }).notNull(),
updatedAt: integer('updated_at', { mode: 'timestamp' }).notNull(),
isActive: integer('is_active', { mode: 'boolean' }).notNull().default(false),