@remit/drizzle-sqlite-schema 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/schema.d.ts CHANGED
@@ -1042,7 +1042,7 @@ export declare const accounts: import("drizzle-orm/sqlite-core").SQLiteTableWith
1042
1042
  data: number;
1043
1043
  driverParam: number;
1044
1044
  notNull: true;
1045
- hasDefault: false;
1045
+ hasDefault: true;
1046
1046
  isPrimaryKey: false;
1047
1047
  isAutoincrement: false;
1048
1048
  hasRuntimeDefault: false;
@@ -2048,6 +2048,143 @@ export declare const filters: import("drizzle-orm/sqlite-core").SQLiteTableWithC
2048
2048
  };
2049
2049
  dialect: "sqlite";
2050
2050
  }>;
2051
+ export declare const labels: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
2052
+ name: "label";
2053
+ schema: undefined;
2054
+ columns: {
2055
+ labelId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2056
+ name: "label_id";
2057
+ tableName: "label";
2058
+ dataType: "string";
2059
+ columnType: "SQLiteText";
2060
+ data: string;
2061
+ driverParam: string;
2062
+ notNull: true;
2063
+ hasDefault: true;
2064
+ isPrimaryKey: true;
2065
+ isAutoincrement: false;
2066
+ hasRuntimeDefault: true;
2067
+ enumValues: [string, ...string[]];
2068
+ baseColumn: never;
2069
+ identity: undefined;
2070
+ generated: undefined;
2071
+ }, {}, {
2072
+ length: number;
2073
+ }>;
2074
+ accountConfigId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2075
+ name: "account_config_id";
2076
+ tableName: "label";
2077
+ dataType: "string";
2078
+ columnType: "SQLiteText";
2079
+ data: string;
2080
+ driverParam: string;
2081
+ notNull: true;
2082
+ hasDefault: false;
2083
+ isPrimaryKey: false;
2084
+ isAutoincrement: false;
2085
+ hasRuntimeDefault: false;
2086
+ enumValues: [string, ...string[]];
2087
+ baseColumn: never;
2088
+ identity: undefined;
2089
+ generated: undefined;
2090
+ }, {}, {
2091
+ length: number;
2092
+ }>;
2093
+ name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2094
+ name: "name";
2095
+ tableName: "label";
2096
+ dataType: "string";
2097
+ columnType: "SQLiteText";
2098
+ data: string;
2099
+ driverParam: string;
2100
+ notNull: true;
2101
+ hasDefault: false;
2102
+ isPrimaryKey: false;
2103
+ isAutoincrement: false;
2104
+ hasRuntimeDefault: false;
2105
+ enumValues: [string, ...string[]];
2106
+ baseColumn: never;
2107
+ identity: undefined;
2108
+ generated: undefined;
2109
+ }, {}, {
2110
+ length: number;
2111
+ }>;
2112
+ normalizedName: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2113
+ name: "normalized_name";
2114
+ tableName: "label";
2115
+ dataType: "string";
2116
+ columnType: "SQLiteText";
2117
+ data: string;
2118
+ driverParam: string;
2119
+ notNull: true;
2120
+ hasDefault: false;
2121
+ isPrimaryKey: false;
2122
+ isAutoincrement: false;
2123
+ hasRuntimeDefault: false;
2124
+ enumValues: [string, ...string[]];
2125
+ baseColumn: never;
2126
+ identity: undefined;
2127
+ generated: undefined;
2128
+ }, {}, {
2129
+ length: number;
2130
+ }>;
2131
+ color: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2132
+ name: "color";
2133
+ tableName: "label";
2134
+ dataType: "string";
2135
+ columnType: "SQLiteText";
2136
+ data: "Default" | "Red" | "Orange" | "Yellow" | "Green" | "Teal" | "Blue" | "Purple" | "Gray";
2137
+ driverParam: string;
2138
+ notNull: true;
2139
+ hasDefault: true;
2140
+ isPrimaryKey: false;
2141
+ isAutoincrement: false;
2142
+ hasRuntimeDefault: false;
2143
+ enumValues: [string, ...string[]];
2144
+ baseColumn: never;
2145
+ identity: undefined;
2146
+ generated: undefined;
2147
+ }, {}, {
2148
+ length: number;
2149
+ $type: "Default" | "Red" | "Orange" | "Yellow" | "Green" | "Teal" | "Blue" | "Purple" | "Gray";
2150
+ }>;
2151
+ createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2152
+ name: "created_at";
2153
+ tableName: "label";
2154
+ dataType: "number";
2155
+ columnType: "SQLiteInteger";
2156
+ data: number;
2157
+ driverParam: number;
2158
+ notNull: true;
2159
+ hasDefault: false;
2160
+ isPrimaryKey: false;
2161
+ isAutoincrement: false;
2162
+ hasRuntimeDefault: false;
2163
+ enumValues: undefined;
2164
+ baseColumn: never;
2165
+ identity: undefined;
2166
+ generated: undefined;
2167
+ }, {}, {}>;
2168
+ updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
2169
+ name: "updated_at";
2170
+ tableName: "label";
2171
+ dataType: "number";
2172
+ columnType: "SQLiteInteger";
2173
+ data: number;
2174
+ driverParam: number;
2175
+ notNull: true;
2176
+ hasDefault: false;
2177
+ isPrimaryKey: false;
2178
+ isAutoincrement: false;
2179
+ hasRuntimeDefault: false;
2180
+ enumValues: undefined;
2181
+ baseColumn: never;
2182
+ identity: undefined;
2183
+ generated: undefined;
2184
+ }, {}, {}>;
2185
+ };
2186
+ dialect: "sqlite";
2187
+ }>;
2051
2188
  export declare const organizeJobRequests: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
2052
2189
  name: "organize_job_request";
2053
2190
  schema: undefined;
@@ -2193,7 +2330,7 @@ export declare const organizeJobRequests: import("drizzle-orm/sqlite-core").SQLi
2193
2330
  data: number;
2194
2331
  driverParam: number;
2195
2332
  notNull: true;
2196
- hasDefault: false;
2333
+ hasDefault: true;
2197
2334
  isPrimaryKey: false;
2198
2335
  isAutoincrement: false;
2199
2336
  hasRuntimeDefault: false;
@@ -2248,7 +2385,7 @@ export declare const organizeJobRequests: import("drizzle-orm/sqlite-core").SQLi
2248
2385
  data: number;
2249
2386
  driverParam: number;
2250
2387
  notNull: true;
2251
- hasDefault: false;
2388
+ hasDefault: true;
2252
2389
  isPrimaryKey: false;
2253
2390
  isAutoincrement: false;
2254
2391
  hasRuntimeDefault: false;
@@ -2265,7 +2402,7 @@ export declare const organizeJobRequests: import("drizzle-orm/sqlite-core").SQLi
2265
2402
  data: number;
2266
2403
  driverParam: number;
2267
2404
  notNull: true;
2268
- hasDefault: false;
2405
+ hasDefault: true;
2269
2406
  isPrimaryKey: false;
2270
2407
  isAutoincrement: false;
2271
2408
  hasRuntimeDefault: false;
@@ -2282,7 +2419,7 @@ export declare const organizeJobRequests: import("drizzle-orm/sqlite-core").SQLi
2282
2419
  data: number;
2283
2420
  driverParam: number;
2284
2421
  notNull: true;
2285
- hasDefault: false;
2422
+ hasDefault: true;
2286
2423
  isPrimaryKey: false;
2287
2424
  isAutoincrement: false;
2288
2425
  hasRuntimeDefault: false;
@@ -3383,7 +3520,7 @@ export declare const addresses: import("drizzle-orm/sqlite-core").SQLiteTableWit
3383
3520
  data: number;
3384
3521
  driverParam: number;
3385
3522
  notNull: true;
3386
- hasDefault: false;
3523
+ hasDefault: true;
3387
3524
  isPrimaryKey: false;
3388
3525
  isAutoincrement: false;
3389
3526
  hasRuntimeDefault: false;
@@ -3400,7 +3537,7 @@ export declare const addresses: import("drizzle-orm/sqlite-core").SQLiteTableWit
3400
3537
  data: number;
3401
3538
  driverParam: number;
3402
3539
  notNull: true;
3403
- hasDefault: false;
3540
+ hasDefault: true;
3404
3541
  isPrimaryKey: false;
3405
3542
  isAutoincrement: false;
3406
3543
  hasRuntimeDefault: false;
@@ -3417,7 +3554,7 @@ export declare const addresses: import("drizzle-orm/sqlite-core").SQLiteTableWit
3417
3554
  data: number;
3418
3555
  driverParam: number;
3419
3556
  notNull: true;
3420
- hasDefault: false;
3557
+ hasDefault: true;
3421
3558
  isPrimaryKey: false;
3422
3559
  isAutoincrement: false;
3423
3560
  hasRuntimeDefault: false;
@@ -3434,7 +3571,7 @@ export declare const addresses: import("drizzle-orm/sqlite-core").SQLiteTableWit
3434
3571
  data: number;
3435
3572
  driverParam: number;
3436
3573
  notNull: true;
3437
- hasDefault: false;
3574
+ hasDefault: true;
3438
3575
  isPrimaryKey: false;
3439
3576
  isAutoincrement: false;
3440
3577
  hasRuntimeDefault: false;
@@ -3468,7 +3605,7 @@ export declare const addresses: import("drizzle-orm/sqlite-core").SQLiteTableWit
3468
3605
  data: number;
3469
3606
  driverParam: number;
3470
3607
  notNull: true;
3471
- hasDefault: false;
3608
+ hasDefault: true;
3472
3609
  isPrimaryKey: false;
3473
3610
  isAutoincrement: false;
3474
3611
  hasRuntimeDefault: false;
@@ -6486,143 +6623,6 @@ export declare const bodyPartContents: import("drizzle-orm/sqlite-core").SQLiteT
6486
6623
  };
6487
6624
  dialect: "sqlite";
6488
6625
  }>;
6489
- export declare const labels: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
6490
- name: "label";
6491
- schema: undefined;
6492
- columns: {
6493
- labelId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
6494
- name: "label_id";
6495
- tableName: "label";
6496
- dataType: "string";
6497
- columnType: "SQLiteText";
6498
- data: string;
6499
- driverParam: string;
6500
- notNull: true;
6501
- hasDefault: true;
6502
- isPrimaryKey: true;
6503
- isAutoincrement: false;
6504
- hasRuntimeDefault: true;
6505
- enumValues: [string, ...string[]];
6506
- baseColumn: never;
6507
- identity: undefined;
6508
- generated: undefined;
6509
- }, {}, {
6510
- length: number;
6511
- }>;
6512
- accountConfigId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
6513
- name: "account_config_id";
6514
- tableName: "label";
6515
- dataType: "string";
6516
- columnType: "SQLiteText";
6517
- data: string;
6518
- driverParam: string;
6519
- notNull: true;
6520
- hasDefault: false;
6521
- isPrimaryKey: false;
6522
- isAutoincrement: false;
6523
- hasRuntimeDefault: false;
6524
- enumValues: [string, ...string[]];
6525
- baseColumn: never;
6526
- identity: undefined;
6527
- generated: undefined;
6528
- }, {}, {
6529
- length: number;
6530
- }>;
6531
- name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
6532
- name: "name";
6533
- tableName: "label";
6534
- dataType: "string";
6535
- columnType: "SQLiteText";
6536
- data: string;
6537
- driverParam: string;
6538
- notNull: true;
6539
- hasDefault: false;
6540
- isPrimaryKey: false;
6541
- isAutoincrement: false;
6542
- hasRuntimeDefault: false;
6543
- enumValues: [string, ...string[]];
6544
- baseColumn: never;
6545
- identity: undefined;
6546
- generated: undefined;
6547
- }, {}, {
6548
- length: number;
6549
- }>;
6550
- normalizedName: import("drizzle-orm/sqlite-core").SQLiteColumn<{
6551
- name: "normalized_name";
6552
- tableName: "label";
6553
- dataType: "string";
6554
- columnType: "SQLiteText";
6555
- data: string;
6556
- driverParam: string;
6557
- notNull: true;
6558
- hasDefault: false;
6559
- isPrimaryKey: false;
6560
- isAutoincrement: false;
6561
- hasRuntimeDefault: false;
6562
- enumValues: [string, ...string[]];
6563
- baseColumn: never;
6564
- identity: undefined;
6565
- generated: undefined;
6566
- }, {}, {
6567
- length: number;
6568
- }>;
6569
- color: import("drizzle-orm/sqlite-core").SQLiteColumn<{
6570
- name: "color";
6571
- tableName: "label";
6572
- dataType: "string";
6573
- columnType: "SQLiteText";
6574
- data: "Default" | "Red" | "Orange" | "Yellow" | "Green" | "Teal" | "Blue" | "Purple" | "Gray";
6575
- driverParam: string;
6576
- notNull: true;
6577
- hasDefault: true;
6578
- isPrimaryKey: false;
6579
- isAutoincrement: false;
6580
- hasRuntimeDefault: false;
6581
- enumValues: [string, ...string[]];
6582
- baseColumn: never;
6583
- identity: undefined;
6584
- generated: undefined;
6585
- }, {}, {
6586
- length: number;
6587
- $type: "Default" | "Red" | "Orange" | "Yellow" | "Green" | "Teal" | "Blue" | "Purple" | "Gray";
6588
- }>;
6589
- createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
6590
- name: "created_at";
6591
- tableName: "label";
6592
- dataType: "number";
6593
- columnType: "SQLiteInteger";
6594
- data: number;
6595
- driverParam: number;
6596
- notNull: true;
6597
- hasDefault: false;
6598
- isPrimaryKey: false;
6599
- isAutoincrement: false;
6600
- hasRuntimeDefault: false;
6601
- enumValues: undefined;
6602
- baseColumn: never;
6603
- identity: undefined;
6604
- generated: undefined;
6605
- }, {}, {}>;
6606
- updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
6607
- name: "updated_at";
6608
- tableName: "label";
6609
- dataType: "number";
6610
- columnType: "SQLiteInteger";
6611
- data: number;
6612
- driverParam: number;
6613
- notNull: true;
6614
- hasDefault: false;
6615
- isPrimaryKey: false;
6616
- isAutoincrement: false;
6617
- hasRuntimeDefault: false;
6618
- enumValues: undefined;
6619
- baseColumn: never;
6620
- identity: undefined;
6621
- generated: undefined;
6622
- }, {}, {}>;
6623
- };
6624
- dialect: "sqlite";
6625
- }>;
6626
6626
  export declare const messageLabels: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
6627
6627
  name: "message_label";
6628
6628
  schema: undefined;
package/dist/schema.js CHANGED
@@ -68,7 +68,7 @@ export const accounts = sqliteTable("account", {
68
68
  imapStartTls: integer("imap_start_tls", { mode: "boolean" }).notNull(),
69
69
  smtpEnabled: integer("smtp_enabled", { mode: "boolean" }).notNull().default(false),
70
70
  smtpHost: text("smtp_host").notNull().default(""),
71
- smtpPort: integer("smtp_port").notNull(),
71
+ smtpPort: integer("smtp_port").notNull().default(587),
72
72
  smtpTls: integer("smtp_tls", { mode: "boolean" }).notNull().default(false),
73
73
  smtpStartTls: integer("smtp_start_tls", { mode: "boolean" }).notNull().default(true),
74
74
  smtpUsername: text("smtp_username").notNull().default(""),
@@ -135,6 +135,18 @@ export const filters = sqliteTable("filter", {
135
135
  index("filter_by_account_and_state").on(table.accountConfigId, table.state, table.filterId),
136
136
  index("filter_primary").on(table.accountConfigId, table.filterId),
137
137
  ]);
138
+ export const labels = sqliteTable("label", {
139
+ labelId: text("label_id").primaryKey().$defaultFn(() => generateBase36Id()),
140
+ accountConfigId: text("account_config_id").notNull(),
141
+ name: text("name").notNull(),
142
+ normalizedName: text("normalized_name").notNull(),
143
+ color: text("color").$type().notNull().default("Default"),
144
+ createdAt: integer("created_at", { mode: "number" }).notNull(),
145
+ updatedAt: integer("updated_at", { mode: "number" }).notNull(),
146
+ }, (table) => [
147
+ index("label_by_normalized_name").on(table.accountConfigId, table.normalizedName),
148
+ index("label_primary").on(table.accountConfigId, table.labelId),
149
+ ]);
138
150
  export const organizeJobRequests = sqliteTable("organize_job_request", {
139
151
  organizeJobId: text("organize_job_id").primaryKey().$defaultFn(() => generateBase36Id()),
140
152
  accountConfigId: text("account_config_id").notNull(),
@@ -143,12 +155,12 @@ export const organizeJobRequests = sqliteTable("organize_job_request", {
143
155
  anchorMessageId: text("anchor_message_id").notNull().default("None"),
144
156
  matchOperator: text("match_operator").$type().notNull().default("And"),
145
157
  literalClauses: text("literal_clauses", { mode: "json" }).notNull().default([]),
146
- similarityThreshold: real("similarity_threshold").notNull(),
158
+ similarityThreshold: real("similarity_threshold").notNull().default(0.75),
147
159
  actionLabelId: text("action_label_id").notNull().default("None"),
148
160
  actionMailboxId: text("action_mailbox_id").notNull().default("None"),
149
- matchedCount: integer("matched_count").notNull(),
150
- appliedCount: integer("applied_count").notNull(),
151
- failedCount: integer("failed_count").notNull(),
161
+ matchedCount: integer("matched_count").notNull().default(0),
162
+ appliedCount: integer("applied_count").notNull().default(0),
163
+ failedCount: integer("failed_count").notNull().default(0),
152
164
  errorMessage: text("error_message").notNull().default(""),
153
165
  ttl: integer("ttl", { mode: "number" }).notNull(),
154
166
  createdAt: integer("created_at", { mode: "number" }).notNull(),
@@ -227,12 +239,12 @@ export const addresses = sqliteTable("address", {
227
239
  normalizedEmail: text("normalized_email").notNull(),
228
240
  normalizedCompound: text("normalized_compound").notNull(),
229
241
  flags: text("flags", { mode: "json" }).notNull(),
230
- inboundCount: integer("inbound_count").notNull(),
231
- outboundCount: integer("outbound_count").notNull(),
232
- replyCount: integer("reply_count").notNull(),
233
- lastInboundAt: integer("last_inbound_at", { mode: "number" }).notNull(),
242
+ inboundCount: integer("inbound_count").notNull().default(0),
243
+ outboundCount: integer("outbound_count").notNull().default(0),
244
+ replyCount: integer("reply_count").notNull().default(0),
245
+ lastInboundAt: integer("last_inbound_at", { mode: "number" }).notNull().default(0),
234
246
  lastOutboundAt: integer("last_outbound_at", { mode: "number" }),
235
- lastReplyAt: integer("last_reply_at", { mode: "number" }).notNull(),
247
+ lastReplyAt: integer("last_reply_at", { mode: "number" }).notNull().default(0),
236
248
  createdAt: integer("created_at", { mode: "number" }).notNull(),
237
249
  updatedAt: integer("updated_at", { mode: "number" }).notNull(),
238
250
  }, (table) => [
@@ -465,18 +477,6 @@ export const bodyPartContents = sqliteTable("body_part_content", {
465
477
  }, (table) => [
466
478
  index("body_part_content_by_message_id").on(table.messageId, table.bodyPartContentId),
467
479
  ]);
468
- export const labels = sqliteTable("label", {
469
- labelId: text("label_id").primaryKey().$defaultFn(() => generateBase36Id()),
470
- accountConfigId: text("account_config_id").notNull(),
471
- name: text("name").notNull(),
472
- normalizedName: text("normalized_name").notNull(),
473
- color: text("color").$type().notNull().default("Default"),
474
- createdAt: integer("created_at", { mode: "number" }).notNull(),
475
- updatedAt: integer("updated_at", { mode: "number" }).notNull(),
476
- }, (table) => [
477
- index("label_by_normalized_name").on(table.accountConfigId, table.normalizedName),
478
- index("label_primary").on(table.accountConfigId, table.labelId),
479
- ]);
480
480
  export const messageLabels = sqliteTable("message_label", {
481
481
  messageLabelId: text("message_label_id").primaryKey().$defaultFn(() => generateBase36Id()),
482
482
  messageId: text("message_id").notNull(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/drizzle-sqlite-schema",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/schema.ts CHANGED
@@ -86,7 +86,7 @@ export const accounts = sqliteTable(
86
86
  imapStartTls: integer("imap_start_tls", { mode: "boolean" }).notNull(),
87
87
  smtpEnabled: integer("smtp_enabled", { mode: "boolean" }).notNull().default(false),
88
88
  smtpHost: text("smtp_host").notNull().default(""),
89
- smtpPort: integer("smtp_port").notNull(),
89
+ smtpPort: integer("smtp_port").notNull().default(587),
90
90
  smtpTls: integer("smtp_tls", { mode: "boolean" }).notNull().default(false),
91
91
  smtpStartTls: integer("smtp_start_tls", { mode: "boolean" }).notNull().default(true),
92
92
  smtpUsername: text("smtp_username").notNull().default(""),
@@ -166,6 +166,23 @@ export const filters = sqliteTable(
166
166
  ],
167
167
  );
168
168
 
169
+ export const labels = sqliteTable(
170
+ "label",
171
+ {
172
+ labelId: text("label_id").primaryKey().$defaultFn(() => generateBase36Id()),
173
+ accountConfigId: text("account_config_id").notNull(),
174
+ name: text("name").notNull(),
175
+ normalizedName: text("normalized_name").notNull(),
176
+ color: text("color").$type<"Default" | "Red" | "Orange" | "Yellow" | "Green" | "Teal" | "Blue" | "Purple" | "Gray">().notNull().default("Default"),
177
+ createdAt: integer("created_at", { mode: "number" }).notNull(),
178
+ updatedAt: integer("updated_at", { mode: "number" }).notNull(),
179
+ },
180
+ (table) => [
181
+ index("label_by_normalized_name").on(table.accountConfigId, table.normalizedName),
182
+ index("label_primary").on(table.accountConfigId, table.labelId),
183
+ ],
184
+ );
185
+
169
186
  export const organizeJobRequests = sqliteTable(
170
187
  "organize_job_request",
171
188
  {
@@ -176,12 +193,12 @@ export const organizeJobRequests = sqliteTable(
176
193
  anchorMessageId: text("anchor_message_id").notNull().default("None"),
177
194
  matchOperator: text("match_operator").$type<"And" | "Or">().notNull().default("And"),
178
195
  literalClauses: text("literal_clauses", { mode: "json" }).notNull().default([]),
179
- similarityThreshold: real("similarity_threshold").notNull(),
196
+ similarityThreshold: real("similarity_threshold").notNull().default(0.75),
180
197
  actionLabelId: text("action_label_id").notNull().default("None"),
181
198
  actionMailboxId: text("action_mailbox_id").notNull().default("None"),
182
- matchedCount: integer("matched_count").notNull(),
183
- appliedCount: integer("applied_count").notNull(),
184
- failedCount: integer("failed_count").notNull(),
199
+ matchedCount: integer("matched_count").notNull().default(0),
200
+ appliedCount: integer("applied_count").notNull().default(0),
201
+ failedCount: integer("failed_count").notNull().default(0),
185
202
  errorMessage: text("error_message").notNull().default(""),
186
203
  ttl: integer("ttl", { mode: "number" }).notNull(),
187
204
  createdAt: integer("created_at", { mode: "number" }).notNull(),
@@ -275,12 +292,12 @@ export const addresses = sqliteTable(
275
292
  normalizedEmail: text("normalized_email").notNull(),
276
293
  normalizedCompound: text("normalized_compound").notNull(),
277
294
  flags: text("flags", { mode: "json" }).notNull(),
278
- inboundCount: integer("inbound_count").notNull(),
279
- outboundCount: integer("outbound_count").notNull(),
280
- replyCount: integer("reply_count").notNull(),
281
- lastInboundAt: integer("last_inbound_at", { mode: "number" }).notNull(),
295
+ inboundCount: integer("inbound_count").notNull().default(0),
296
+ outboundCount: integer("outbound_count").notNull().default(0),
297
+ replyCount: integer("reply_count").notNull().default(0),
298
+ lastInboundAt: integer("last_inbound_at", { mode: "number" }).notNull().default(0),
282
299
  lastOutboundAt: integer("last_outbound_at", { mode: "number" }),
283
- lastReplyAt: integer("last_reply_at", { mode: "number" }).notNull(),
300
+ lastReplyAt: integer("last_reply_at", { mode: "number" }).notNull().default(0),
284
301
  createdAt: integer("created_at", { mode: "number" }).notNull(),
285
302
  updatedAt: integer("updated_at", { mode: "number" }).notNull(),
286
303
  },
@@ -601,23 +618,6 @@ export const bodyPartContents = sqliteTable(
601
618
  ],
602
619
  );
603
620
 
604
- export const labels = sqliteTable(
605
- "label",
606
- {
607
- labelId: text("label_id").primaryKey().$defaultFn(() => generateBase36Id()),
608
- accountConfigId: text("account_config_id").notNull(),
609
- name: text("name").notNull(),
610
- normalizedName: text("normalized_name").notNull(),
611
- color: text("color").$type<"Default" | "Red" | "Orange" | "Yellow" | "Green" | "Teal" | "Blue" | "Purple" | "Gray">().notNull().default("Default"),
612
- createdAt: integer("created_at", { mode: "number" }).notNull(),
613
- updatedAt: integer("updated_at", { mode: "number" }).notNull(),
614
- },
615
- (table) => [
616
- index("label_by_normalized_name").on(table.accountConfigId, table.normalizedName),
617
- index("label_primary").on(table.accountConfigId, table.labelId),
618
- ],
619
- );
620
-
621
621
  export const messageLabels = sqliteTable(
622
622
  "message_label",
623
623
  {