Skip to content

Commit 46a21b7

Browse files
committed
add initial idle detection implementation
1 parent 3286250 commit 46a21b7

30 files changed

Lines changed: 9480 additions & 7312 deletions

drizzle.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from 'drizzle-kit'
2+
3+
export default defineConfig({
4+
schema: './src/main/db/schema.ts',
5+
out: './drizzle',
6+
dialect: 'sqlite',
7+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CREATE TABLE `activity_periods` (
2+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
3+
`start` text NOT NULL,
4+
`end` text NOT NULL,
5+
`is_idle` integer NOT NULL,
6+
`created_at` text NOT NULL
7+
);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CREATE TABLE `settings` (
2+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
3+
`key` text NOT NULL,
4+
`value` text NOT NULL,
5+
`updated_at` text NOT NULL,
6+
UNIQUE(`key`)
7+
);
8+
9+
-- Insert default settings
10+
INSERT INTO `settings` (`key`, `value`, `updated_at`) VALUES
11+
('widget_activated', 'true', datetime('now')),
12+
('tray_timer_activated', 'true', datetime('now')),
13+
('idle_detection_enabled', 'true', datetime('now')),
14+
('idle_threshold_minutes', '5', datetime('now'));

drizzle/meta/0000_snapshot.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"version": "6",
3+
"dialect": "sqlite",
4+
"id": "ff15e91e-a2a5-4ab4-94ee-2f1d1ae08f62",
5+
"prevId": "00000000-0000-0000-0000-000000000000",
6+
"tables": {
7+
"activity_periods": {
8+
"name": "activity_periods",
9+
"columns": {
10+
"id": {
11+
"name": "id",
12+
"type": "integer",
13+
"primaryKey": true,
14+
"notNull": true,
15+
"autoincrement": true
16+
},
17+
"start": {
18+
"name": "start",
19+
"type": "text",
20+
"primaryKey": false,
21+
"notNull": true,
22+
"autoincrement": false
23+
},
24+
"end": {
25+
"name": "end",
26+
"type": "text",
27+
"primaryKey": false,
28+
"notNull": true,
29+
"autoincrement": false
30+
},
31+
"is_idle": {
32+
"name": "is_idle",
33+
"type": "integer",
34+
"primaryKey": false,
35+
"notNull": true,
36+
"autoincrement": false
37+
},
38+
"created_at": {
39+
"name": "created_at",
40+
"type": "text",
41+
"primaryKey": false,
42+
"notNull": true,
43+
"autoincrement": false
44+
}
45+
},
46+
"indexes": {},
47+
"foreignKeys": {},
48+
"compositePrimaryKeys": {},
49+
"uniqueConstraints": {},
50+
"checkConstraints": {}
51+
}
52+
},
53+
"views": {},
54+
"enums": {},
55+
"_meta": {
56+
"schemas": {},
57+
"tables": {},
58+
"columns": {}
59+
},
60+
"internal": {
61+
"indexes": {}
62+
}
63+
}

drizzle/meta/0001_snapshot.json

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"version": "6",
3+
"dialect": "sqlite",
4+
"id": "a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d",
5+
"prevId": "ff15e91e-a2a5-4ab4-94ee-2f1d1ae08f62",
6+
"tables": {
7+
"activity_periods": {
8+
"name": "activity_periods",
9+
"columns": {
10+
"id": {
11+
"name": "id",
12+
"type": "integer",
13+
"primaryKey": true,
14+
"notNull": true,
15+
"autoincrement": true
16+
},
17+
"start": {
18+
"name": "start",
19+
"type": "text",
20+
"primaryKey": false,
21+
"notNull": true,
22+
"autoincrement": false
23+
},
24+
"end": {
25+
"name": "end",
26+
"type": "text",
27+
"primaryKey": false,
28+
"notNull": true,
29+
"autoincrement": false
30+
},
31+
"is_idle": {
32+
"name": "is_idle",
33+
"type": "integer",
34+
"primaryKey": false,
35+
"notNull": true,
36+
"autoincrement": false
37+
},
38+
"created_at": {
39+
"name": "created_at",
40+
"type": "text",
41+
"primaryKey": false,
42+
"notNull": true,
43+
"autoincrement": false
44+
}
45+
},
46+
"indexes": {},
47+
"foreignKeys": {},
48+
"compositePrimaryKeys": {},
49+
"uniqueConstraints": {},
50+
"checkConstraints": {}
51+
},
52+
"settings": {
53+
"name": "settings",
54+
"columns": {
55+
"id": {
56+
"name": "id",
57+
"type": "integer",
58+
"primaryKey": true,
59+
"notNull": true,
60+
"autoincrement": true
61+
},
62+
"key": {
63+
"name": "key",
64+
"type": "text",
65+
"primaryKey": false,
66+
"notNull": true,
67+
"autoincrement": false
68+
},
69+
"value": {
70+
"name": "value",
71+
"type": "text",
72+
"primaryKey": false,
73+
"notNull": true,
74+
"autoincrement": false
75+
},
76+
"updated_at": {
77+
"name": "updated_at",
78+
"type": "text",
79+
"primaryKey": false,
80+
"notNull": true,
81+
"autoincrement": false
82+
}
83+
},
84+
"indexes": {
85+
"settings_key_unique": {
86+
"name": "settings_key_unique",
87+
"columns": ["key"],
88+
"isUnique": true
89+
}
90+
},
91+
"foreignKeys": {},
92+
"compositePrimaryKeys": {},
93+
"uniqueConstraints": {},
94+
"checkConstraints": {}
95+
}
96+
},
97+
"views": {},
98+
"enums": {},
99+
"_meta": {
100+
"schemas": {},
101+
"tables": {},
102+
"columns": {}
103+
},
104+
"internal": {
105+
"indexes": {}
106+
}
107+
}

drizzle/meta/_journal.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "7",
3+
"dialect": "sqlite",
4+
"entries": [
5+
{
6+
"idx": 0,
7+
"version": "6",
8+
"when": 1763389706823,
9+
"tag": "0000_create_activity_periods_table",
10+
"breakpoints": true
11+
},
12+
{
13+
"idx": 1,
14+
"version": "6",
15+
"when": 1731945600000,
16+
"tag": "0001_add_settings_table",
17+
"breakpoints": true
18+
}
19+
]
20+
}

0 commit comments

Comments
 (0)