feat: added dataPath for projects
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user