@@ -5,52 +5,49 @@ var ZenPinnedTabsStorage = {
5
5
} ,
6
6
7
7
async _ensureTable ( ) {
8
- return new Promise ( async ( resolve , reject ) => {
9
- await PlacesUtils . withConnectionWrapper ( 'ZenPinnedTabsStorage._ensureTable' , async ( db ) => {
10
- console . log ( 'ZenPinnedTabsStorage: Ensuring tables...' ) ;
11
- // Create the pins table if it doesn't exist
12
- await db . execute ( `
13
- CREATE TABLE IF NOT EXISTS zen_pins (
14
- id INTEGER PRIMARY KEY,
15
- uuid TEXT UNIQUE NOT NULL,
16
- title TEXT NOT NULL,
17
- url TEXT,
18
- container_id INTEGER,
19
- workspace_uuid TEXT,
20
- position INTEGER NOT NULL DEFAULT 0,
21
- is_essential BOOLEAN NOT NULL DEFAULT 0,
22
- is_group BOOLEAN NOT NULL DEFAULT 0,
23
- parent_uuid TEXT,
24
- created_at INTEGER NOT NULL,
25
- updated_at INTEGER NOT NULL,
26
- FOREIGN KEY (parent_uuid) REFERENCES zen_pins(uuid) ON DELETE SET NULL
27
- )
28
- ` ) ;
29
-
30
-
31
- // Create indices
32
- await db . execute ( `
33
- CREATE INDEX IF NOT EXISTS idx_zen_pins_uuid ON zen_pins(uuid)
34
- ` ) ;
8
+ await PlacesUtils . withConnectionWrapper ( 'ZenPinnedTabsStorage._ensureTable' , async ( db ) => {
9
+ console . log ( 'ZenPinnedTabsStorage: Ensuring tables...' ) ;
10
+ // Create the pins table if it doesn't exist
11
+ await db . execute ( `
12
+ CREATE TABLE IF NOT EXISTS zen_pins (
13
+ id INTEGER PRIMARY KEY,
14
+ uuid TEXT UNIQUE NOT NULL,
15
+ title TEXT NOT NULL,
16
+ url TEXT,
17
+ container_id INTEGER,
18
+ workspace_uuid TEXT,
19
+ position INTEGER NOT NULL DEFAULT 0,
20
+ is_essential BOOLEAN NOT NULL DEFAULT 0,
21
+ is_group BOOLEAN NOT NULL DEFAULT 0,
22
+ parent_uuid TEXT,
23
+ created_at INTEGER NOT NULL,
24
+ updated_at INTEGER NOT NULL,
25
+ FOREIGN KEY (parent_uuid) REFERENCES zen_pins(uuid) ON DELETE SET NULL
26
+ )
27
+ ` ) ;
35
28
36
- await db . execute ( `
37
- CREATE INDEX IF NOT EXISTS idx_zen_pins_parent_uuid ON zen_pins(parent_uuid)
38
- ` ) ;
39
29
40
- // Create the changes tracking table if it doesn't exist
41
- await db . execute ( `
42
- CREATE TABLE IF NOT EXISTS zen_pins_changes (
43
- uuid TEXT PRIMARY KEY,
44
- timestamp INTEGER NOT NULL
45
- )
46
- ` ) ;
30
+ // Create indices
31
+ await db . execute ( `
32
+ CREATE INDEX IF NOT EXISTS idx_zen_pins_uuid ON zen_pins(uuid)
33
+ ` ) ;
47
34
48
- // Create an index on the uuid column for changes tracking table
49
- await db . execute ( `
50
- CREATE INDEX IF NOT EXISTS idx_zen_pins_changes_uuid ON zen_pins_changes(uuid)
51
- ` ) ;
52
- resolve ( ) ;
53
- } ) ;
35
+ await db . execute ( `
36
+ CREATE INDEX IF NOT EXISTS idx_zen_pins_parent_uuid ON zen_pins(parent_uuid)
37
+ ` ) ;
38
+
39
+ // Create the changes tracking table if it doesn't exist
40
+ await db . execute ( `
41
+ CREATE TABLE IF NOT EXISTS zen_pins_changes (
42
+ uuid TEXT PRIMARY KEY,
43
+ timestamp INTEGER NOT NULL
44
+ )
45
+ ` ) ;
46
+
47
+ // Create an index on the uuid column for changes tracking table
48
+ await db . execute ( `
49
+ CREATE INDEX IF NOT EXISTS idx_zen_pins_changes_uuid ON zen_pins_changes(uuid)
50
+ ` ) ;
54
51
} ) ;
55
52
} ,
56
53
0 commit comments