diff --git a/migrations/README.md b/migrations/README.md index 2ee38e0001..fc11adc188 100644 --- a/migrations/README.md +++ b/migrations/README.md @@ -1,6 +1,6 @@ **THIS DIRECTORY IS NOT FOR RUNTIME USE** - Using `libsql` as the `sqlite3` driver, and `drizzle` as the ORM and database migration tool -- `migrations/sqlite-drizzle` contains auto-generated migration data. Please **DO NOT** modify it. +- `migrations/sqlite-drizzle` contains auto-generated migration data. Please **DO NOT** modify it. - If table structure changes, we should run migrations. - To generate migrations, use the command `yarn run migrations:generate` diff --git a/migrations/sqlite-drizzle/meta/0000_snapshot.json b/migrations/sqlite-drizzle/meta/0000_snapshot.json index 14e22e0156..51c5ed6cba 100644 --- a/migrations/sqlite-drizzle/meta/0000_snapshot.json +++ b/migrations/sqlite-drizzle/meta/0000_snapshot.json @@ -1,117 +1,114 @@ { - "version": "6", + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + }, "dialect": "sqlite", + "enums": {}, "id": "de8009d7-95b9-4f99-99fa-4b8795708f21", + "internal": { + "indexes": {} + }, "prevId": "00000000-0000-0000-0000-000000000000", "tables": { "app_state": { - "name": "app_state", + "checkConstraints": {}, "columns": { - "key": { - "name": "key", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "text", + "created_at": { + "autoincrement": false, + "name": "created_at", + "notNull": false, "primaryKey": false, - "notNull": true, - "autoincrement": false + "type": "integer" }, "description": { + "autoincrement": false, "name": "description", - "type": "text", - "primaryKey": false, "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "preference": { - "name": "preference", - "columns": { - "scope": { - "name": "scope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false + "type": "text" }, "key": { + "autoincrement": false, "name": "key", - "type": "text", - "primaryKey": false, "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false + "primaryKey": true, + "type": "text" }, "updated_at": { + "autoincrement": false, "name": "updated_at", - "type": "integer", - "primaryKey": false, "notNull": false, - "autoincrement": false + "primaryKey": false, + "type": "integer" + }, + "value": { + "autoincrement": false, + "name": "value", + "notNull": true, + "primaryKey": false, + "type": "text" } }, + "compositePrimaryKeys": {}, + "foreignKeys": {}, + "indexes": {}, + "name": "app_state", + "uniqueConstraints": {} + }, + "preference": { + "checkConstraints": {}, + "columns": { + "created_at": { + "autoincrement": false, + "name": "created_at", + "notNull": false, + "primaryKey": false, + "type": "integer" + }, + "key": { + "autoincrement": false, + "name": "key", + "notNull": true, + "primaryKey": false, + "type": "text" + }, + "scope": { + "autoincrement": false, + "name": "scope", + "notNull": true, + "primaryKey": false, + "type": "text" + }, + "updated_at": { + "autoincrement": false, + "name": "updated_at", + "notNull": false, + "primaryKey": false, + "type": "integer" + }, + "value": { + "autoincrement": false, + "name": "value", + "notNull": false, + "primaryKey": false, + "type": "text" + } + }, + "compositePrimaryKeys": {}, + "foreignKeys": {}, "indexes": { "scope_name_idx": { - "name": "scope_name_idx", - "columns": [ - "scope", - "key" - ], - "isUnique": false + "columns": ["scope", "key"], + "isUnique": false, + "name": "scope_name_idx" } }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} + "name": "preference", + "uniqueConstraints": {} } }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": {} - } -} \ No newline at end of file + "version": "6", + "views": {} +} diff --git a/migrations/sqlite-drizzle/meta/_journal.json b/migrations/sqlite-drizzle/meta/_journal.json index df762a19b0..db2791fd7f 100644 --- a/migrations/sqlite-drizzle/meta/_journal.json +++ b/migrations/sqlite-drizzle/meta/_journal.json @@ -1,13 +1,13 @@ { - "version": "7", "dialect": "sqlite", "entries": [ { + "breakpoints": true, "idx": 0, - "version": "6", - "when": 1754745234572, "tag": "0000_solid_lord_hawal", - "breakpoints": true + "version": "6", + "when": 1754745234572 } - ] -} \ No newline at end of file + ], + "version": "7" +} diff --git a/src/renderer/dataRefactorMigrate.html b/src/renderer/dataRefactorMigrate.html index 93e2bfbec1..6b0287db2c 100644 --- a/src/renderer/dataRefactorMigrate.html +++ b/src/renderer/dataRefactorMigrate.html @@ -1,62 +1,61 @@ - + + + + Cherry Studio - Data Refactor Migration + + + - - - Cherry Studio - Data Refactor Migration - - - + + + - - - \ No newline at end of file + /* Non-primary button hover styles */ + .ant-btn:not(.ant-btn-primary):hover { + border-color: var(--color-primary-soft) !important; + color: var(--color-primary) !important; + } + + + diff --git a/src/renderer/dataRefactorTest.html b/src/renderer/dataRefactorTest.html index 20309b3526..9a8c31a041 100644 --- a/src/renderer/dataRefactorTest.html +++ b/src/renderer/dataRefactorTest.html @@ -1,63 +1,62 @@ - + + + + Data Refactor Test Window - PreferenceService Testing + + + - - - Data Refactor Test Window - PreferenceService Testing - - - + + + - - - \ No newline at end of file + /* Non-primary button hover styles */ + .ant-btn:not(.ant-btn-primary):hover { + border-color: var(--color-primary-soft) !important; + color: var(--color-primary) !important; + } + + + diff --git a/src/renderer/src/windows/dataRefactorTest/README.md b/src/renderer/src/windows/dataRefactorTest/README.md index 79536c6ebc..28009e7ad2 100644 --- a/src/renderer/src/windows/dataRefactorTest/README.md +++ b/src/renderer/src/windows/dataRefactorTest/README.md @@ -5,6 +5,7 @@ ## 🎯 当前实现 ✅ **已完成的功能**: + - 专用的测试窗口 (DataRefactorTestWindow) - **双窗口启动**:应用启动时会同时打开主窗口和两个测试窗口 - **跨窗口同步测试**:两个测试窗口可以相互验证偏好设置的实时同步 @@ -18,11 +19,13 @@ ## 测试组件 ### 1. PreferenceService 基础测试 + - 直接测试服务层API:get, set, getCachedValue, isCached, preload, getMultiple - 支持各种数据类型:字符串、数字、布尔值、JSON对象 - 实时显示操作结果 -### 2. usePreference Hook 测试 +### 2. usePreference Hook 测试 + - 测试单个偏好设置的React hooks - 支持的测试键: - `app.theme.mode` - 主题模式 @@ -35,6 +38,7 @@ - **Slider联动控制**:数值类型偏好设置提供交互式滑块,支持实时拖拽调整 ### 3. usePreferences 批量操作测试 + - 测试多个偏好设置的批量管理 - 5种预设场景:基础设置、UI设置、用户设置、🎛️数值设置、自定义组合 - **🎛️ 数值设置场景**:专门的Slider联动控制区域,包含缩放、字体、选择窗口透明度三个滑块 @@ -42,6 +46,7 @@ - 快速切换操作 ### 4. Hook 高级功能测试 + - 预加载机制测试 - 订阅机制验证 - 缓存管理测试 @@ -53,6 +58,7 @@ **自动启动**:应用正常启动时会自动创建两个测试窗口,窗口会自动错位显示避免重叠 **手动启动**: + ```javascript // 在开发者控制台中执行 - 创建单个测试窗口 const { dataRefactorMigrateService } = require('./out/main/data/migrate/dataRefactor/DataRefactorMigrateService') @@ -71,7 +77,7 @@ dataRefactorMigrateService.closeTestWindows() ``` src/renderer/src/windows/dataRefactorTest/ ├── entryPoint.tsx # 窗口入口 -├── TestApp.tsx # 主应用组件 +├── TestApp.tsx # 主应用组件 └── components/ ├── PreferenceServiceTests.tsx # 服务层测试 ├── PreferenceBasicTests.tsx # 基础Hook测试 @@ -82,12 +88,14 @@ src/renderer/src/windows/dataRefactorTest/ ## 跨窗口同步测试 🔄 **测试场景**: + 1. **实时同步验证**:在窗口#1中修改某个偏好设置,立即观察窗口#2是否同步更新 2. **并发修改测试**:在两个窗口中快速连续修改同一设置,验证数据一致性 3. **批量操作同步**:在一个窗口中批量更新多个设置,观察另一个窗口的同步表现 4. **Hook实例同步**:验证多个usePreference hook实例是否正确同步 📋 **测试步骤**: + 1. 同时打开两个测试窗口(自动启动) 2. 选择相同的偏好设置键进行测试 3. 在窗口#1中修改值,观察窗口#2的反应 @@ -125,4 +133,4 @@ src/renderer/src/windows/dataRefactorTest/ - **实时主题**: 使用 useSyncExternalStore 实现主题、缩放等设置的实时UI响应 - **跨窗口识别**: 多源窗口编号支持,确保每个窗口都有唯一标识 - **UI框架**: Ant Design + styled-components + React 18 -- **类型安全**: 完整的 TypeScript 类型检查和偏好设置键约束 \ No newline at end of file +- **类型安全**: 完整的 TypeScript 类型检查和偏好设置键约束