Skip to content

Commit 415c488

Browse files
committed
perf: snapshot appId type
1 parent 4608c35 commit 415c488

File tree

6 files changed

+357
-12
lines changed

6 files changed

+357
-12
lines changed
Lines changed: 350 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,350 @@
1+
{
2+
"formatVersion": 1,
3+
"database": {
4+
"version": 12,
5+
"identityHash": "58d6b0ebb55bc58ac6016a2b675e3ac4",
6+
"entities": [
7+
{
8+
"tableName": "subs_item",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `ctime` INTEGER NOT NULL, `mtime` INTEGER NOT NULL, `enable` INTEGER NOT NULL, `enable_update` INTEGER NOT NULL, `order` INTEGER NOT NULL, `update_url` TEXT, PRIMARY KEY(`id`))",
10+
"fields": [
11+
{
12+
"fieldPath": "id",
13+
"columnName": "id",
14+
"affinity": "INTEGER",
15+
"notNull": true
16+
},
17+
{
18+
"fieldPath": "ctime",
19+
"columnName": "ctime",
20+
"affinity": "INTEGER",
21+
"notNull": true
22+
},
23+
{
24+
"fieldPath": "mtime",
25+
"columnName": "mtime",
26+
"affinity": "INTEGER",
27+
"notNull": true
28+
},
29+
{
30+
"fieldPath": "enable",
31+
"columnName": "enable",
32+
"affinity": "INTEGER",
33+
"notNull": true
34+
},
35+
{
36+
"fieldPath": "enableUpdate",
37+
"columnName": "enable_update",
38+
"affinity": "INTEGER",
39+
"notNull": true
40+
},
41+
{
42+
"fieldPath": "order",
43+
"columnName": "order",
44+
"affinity": "INTEGER",
45+
"notNull": true
46+
},
47+
{
48+
"fieldPath": "updateUrl",
49+
"columnName": "update_url",
50+
"affinity": "TEXT"
51+
}
52+
],
53+
"primaryKey": {
54+
"autoGenerate": false,
55+
"columnNames": [
56+
"id"
57+
]
58+
}
59+
},
60+
{
61+
"tableName": "snapshot",
62+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `app_id` TEXT NOT NULL, `activity_id` TEXT, `screen_height` INTEGER NOT NULL, `screen_width` INTEGER NOT NULL, `is_landscape` INTEGER NOT NULL, `github_asset_id` INTEGER, PRIMARY KEY(`id`))",
63+
"fields": [
64+
{
65+
"fieldPath": "id",
66+
"columnName": "id",
67+
"affinity": "INTEGER",
68+
"notNull": true
69+
},
70+
{
71+
"fieldPath": "appId",
72+
"columnName": "app_id",
73+
"affinity": "TEXT",
74+
"notNull": true
75+
},
76+
{
77+
"fieldPath": "activityId",
78+
"columnName": "activity_id",
79+
"affinity": "TEXT"
80+
},
81+
{
82+
"fieldPath": "screenHeight",
83+
"columnName": "screen_height",
84+
"affinity": "INTEGER",
85+
"notNull": true
86+
},
87+
{
88+
"fieldPath": "screenWidth",
89+
"columnName": "screen_width",
90+
"affinity": "INTEGER",
91+
"notNull": true
92+
},
93+
{
94+
"fieldPath": "isLandscape",
95+
"columnName": "is_landscape",
96+
"affinity": "INTEGER",
97+
"notNull": true
98+
},
99+
{
100+
"fieldPath": "githubAssetId",
101+
"columnName": "github_asset_id",
102+
"affinity": "INTEGER"
103+
}
104+
],
105+
"primaryKey": {
106+
"autoGenerate": false,
107+
"columnNames": [
108+
"id"
109+
]
110+
}
111+
},
112+
{
113+
"tableName": "subs_config",
114+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `type` INTEGER NOT NULL, `enable` INTEGER, `subs_id` INTEGER NOT NULL, `app_id` TEXT NOT NULL, `group_key` INTEGER NOT NULL, `exclude` TEXT NOT NULL DEFAULT '', PRIMARY KEY(`id`))",
115+
"fields": [
116+
{
117+
"fieldPath": "id",
118+
"columnName": "id",
119+
"affinity": "INTEGER",
120+
"notNull": true
121+
},
122+
{
123+
"fieldPath": "type",
124+
"columnName": "type",
125+
"affinity": "INTEGER",
126+
"notNull": true
127+
},
128+
{
129+
"fieldPath": "enable",
130+
"columnName": "enable",
131+
"affinity": "INTEGER"
132+
},
133+
{
134+
"fieldPath": "subsId",
135+
"columnName": "subs_id",
136+
"affinity": "INTEGER",
137+
"notNull": true
138+
},
139+
{
140+
"fieldPath": "appId",
141+
"columnName": "app_id",
142+
"affinity": "TEXT",
143+
"notNull": true
144+
},
145+
{
146+
"fieldPath": "groupKey",
147+
"columnName": "group_key",
148+
"affinity": "INTEGER",
149+
"notNull": true
150+
},
151+
{
152+
"fieldPath": "exclude",
153+
"columnName": "exclude",
154+
"affinity": "TEXT",
155+
"notNull": true,
156+
"defaultValue": "''"
157+
}
158+
],
159+
"primaryKey": {
160+
"autoGenerate": false,
161+
"columnNames": [
162+
"id"
163+
]
164+
}
165+
},
166+
{
167+
"tableName": "category_config",
168+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `enable` INTEGER, `subs_id` INTEGER NOT NULL, `category_key` INTEGER NOT NULL, PRIMARY KEY(`id`))",
169+
"fields": [
170+
{
171+
"fieldPath": "id",
172+
"columnName": "id",
173+
"affinity": "INTEGER",
174+
"notNull": true
175+
},
176+
{
177+
"fieldPath": "enable",
178+
"columnName": "enable",
179+
"affinity": "INTEGER"
180+
},
181+
{
182+
"fieldPath": "subsId",
183+
"columnName": "subs_id",
184+
"affinity": "INTEGER",
185+
"notNull": true
186+
},
187+
{
188+
"fieldPath": "categoryKey",
189+
"columnName": "category_key",
190+
"affinity": "INTEGER",
191+
"notNull": true
192+
}
193+
],
194+
"primaryKey": {
195+
"autoGenerate": false,
196+
"columnNames": [
197+
"id"
198+
]
199+
}
200+
},
201+
{
202+
"tableName": "action_log",
203+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `ctime` INTEGER NOT NULL, `app_id` TEXT NOT NULL, `activity_id` TEXT, `subs_id` INTEGER NOT NULL, `subs_version` INTEGER NOT NULL DEFAULT 0, `group_key` INTEGER NOT NULL, `group_type` INTEGER NOT NULL DEFAULT 2, `rule_index` INTEGER NOT NULL, `rule_key` INTEGER)",
204+
"fields": [
205+
{
206+
"fieldPath": "id",
207+
"columnName": "id",
208+
"affinity": "INTEGER",
209+
"notNull": true
210+
},
211+
{
212+
"fieldPath": "ctime",
213+
"columnName": "ctime",
214+
"affinity": "INTEGER",
215+
"notNull": true
216+
},
217+
{
218+
"fieldPath": "appId",
219+
"columnName": "app_id",
220+
"affinity": "TEXT",
221+
"notNull": true
222+
},
223+
{
224+
"fieldPath": "activityId",
225+
"columnName": "activity_id",
226+
"affinity": "TEXT"
227+
},
228+
{
229+
"fieldPath": "subsId",
230+
"columnName": "subs_id",
231+
"affinity": "INTEGER",
232+
"notNull": true
233+
},
234+
{
235+
"fieldPath": "subsVersion",
236+
"columnName": "subs_version",
237+
"affinity": "INTEGER",
238+
"notNull": true,
239+
"defaultValue": "0"
240+
},
241+
{
242+
"fieldPath": "groupKey",
243+
"columnName": "group_key",
244+
"affinity": "INTEGER",
245+
"notNull": true
246+
},
247+
{
248+
"fieldPath": "groupType",
249+
"columnName": "group_type",
250+
"affinity": "INTEGER",
251+
"notNull": true,
252+
"defaultValue": "2"
253+
},
254+
{
255+
"fieldPath": "ruleIndex",
256+
"columnName": "rule_index",
257+
"affinity": "INTEGER",
258+
"notNull": true
259+
},
260+
{
261+
"fieldPath": "ruleKey",
262+
"columnName": "rule_key",
263+
"affinity": "INTEGER"
264+
}
265+
],
266+
"primaryKey": {
267+
"autoGenerate": true,
268+
"columnNames": [
269+
"id"
270+
]
271+
}
272+
},
273+
{
274+
"tableName": "activity_log_v2",
275+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `ctime` INTEGER NOT NULL, `app_id` TEXT NOT NULL, `activity_id` TEXT)",
276+
"fields": [
277+
{
278+
"fieldPath": "id",
279+
"columnName": "id",
280+
"affinity": "INTEGER",
281+
"notNull": true
282+
},
283+
{
284+
"fieldPath": "ctime",
285+
"columnName": "ctime",
286+
"affinity": "INTEGER",
287+
"notNull": true
288+
},
289+
{
290+
"fieldPath": "appId",
291+
"columnName": "app_id",
292+
"affinity": "TEXT",
293+
"notNull": true
294+
},
295+
{
296+
"fieldPath": "activityId",
297+
"columnName": "activity_id",
298+
"affinity": "TEXT"
299+
}
300+
],
301+
"primaryKey": {
302+
"autoGenerate": true,
303+
"columnNames": [
304+
"id"
305+
]
306+
}
307+
},
308+
{
309+
"tableName": "app_config",
310+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `enable` INTEGER NOT NULL, `subs_id` INTEGER NOT NULL, `app_id` TEXT NOT NULL, PRIMARY KEY(`id`))",
311+
"fields": [
312+
{
313+
"fieldPath": "id",
314+
"columnName": "id",
315+
"affinity": "INTEGER",
316+
"notNull": true
317+
},
318+
{
319+
"fieldPath": "enable",
320+
"columnName": "enable",
321+
"affinity": "INTEGER",
322+
"notNull": true
323+
},
324+
{
325+
"fieldPath": "subsId",
326+
"columnName": "subs_id",
327+
"affinity": "INTEGER",
328+
"notNull": true
329+
},
330+
{
331+
"fieldPath": "appId",
332+
"columnName": "app_id",
333+
"affinity": "TEXT",
334+
"notNull": true
335+
}
336+
],
337+
"primaryKey": {
338+
"autoGenerate": false,
339+
"columnNames": [
340+
"id"
341+
]
342+
}
343+
}
344+
],
345+
"setupQueries": [
346+
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
347+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '58d6b0ebb55bc58ac6016a2b675e3ac4')"
348+
]
349+
}
350+
}

app/src/main/kotlin/li/songe/gkd/data/BaseSnapshot.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package li.songe.gkd.data
33
interface BaseSnapshot {
44
val id: Long
55

6-
val appId: String?
6+
val appId: String
77
val activityId: String?
88

99
val screenHeight: Int

app/src/main/kotlin/li/songe/gkd/data/ComplexSnapshot.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import li.songe.gkd.util.getPkgInfo
66
@Serializable
77
data class ComplexSnapshot(
88
override val id: Long,
9-
override val appId: String?,
9+
override val appId: String,
1010
override val activityId: String?,
1111
override val screenHeight: Int,
1212
override val screenWidth: Int,
1313
override val isLandscape: Boolean,
14-
val appInfo: AppInfo? = appId?.let { getPkgInfo(appId)?.toAppInfo() },
14+
val appInfo: AppInfo? = getPkgInfo(appId)?.toAppInfo(),
1515
val gkdAppInfo: AppInfo? = selfAppInfo,
1616
val device: DeviceInfo = DeviceInfo.instance,
1717
val nodes: List<NodeInfo>,

app/src/main/kotlin/li/songe/gkd/data/Snapshot.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import li.songe.gkd.util.format
2121
data class Snapshot(
2222
@PrimaryKey @ColumnInfo(name = "id") override val id: Long,
2323

24-
@ColumnInfo(name = "app_id") override val appId: String?,
24+
@ColumnInfo(name = "app_id") override val appId: String,
2525
@ColumnInfo(name = "activity_id") override val activityId: String?,
2626

2727
@ColumnInfo(name = "screen_height") override val screenHeight: Int,

0 commit comments

Comments
 (0)