Skip to content

Commit 435186a

Browse files
committed
fix: update timestamp fields to use milliseconds instead of seconds
1 parent 119b8ec commit 435186a

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

drizzle/0000_whole_sandman.sql renamed to drizzle/0000_sudden_doomsday.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ CREATE TABLE `branches` (
22
`id` text PRIMARY KEY NOT NULL,
33
`project_id` text NOT NULL,
44
`name` text NOT NULL,
5-
`created_at` integer DEFAULT (strftime('%s','now')) NOT NULL,
6-
`updated_at` integer DEFAULT (strftime('%s','now')) NOT NULL,
5+
`created_at` integer DEFAULT (strftime('%s','now') * 1000) NOT NULL,
6+
`updated_at` integer DEFAULT (strftime('%s','now') * 1000) NOT NULL,
77
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE no action
88
);
99
--> statement-breakpoint
@@ -12,17 +12,17 @@ CREATE TABLE `intents` (
1212
`message` text NOT NULL,
1313
`status` text NOT NULL,
1414
`branch_id` text,
15-
`created_at` integer DEFAULT (strftime('%s','now')) NOT NULL,
16-
`updated_at` integer DEFAULT (strftime('%s','now')) NOT NULL,
15+
`created_at` integer DEFAULT (strftime('%s','now') * 1000) NOT NULL,
16+
`updated_at` integer DEFAULT (strftime('%s','now') * 1000) NOT NULL,
1717
FOREIGN KEY (`branch_id`) REFERENCES `branches`(`id`) ON UPDATE no action ON DELETE no action
1818
);
1919
--> statement-breakpoint
2020
CREATE TABLE `projects` (
2121
`id` text PRIMARY KEY NOT NULL,
2222
`repo_path` text NOT NULL,
2323
`repo_name` text NOT NULL,
24-
`created_at` integer DEFAULT (strftime('%s','now')) NOT NULL,
25-
`updated_at` integer DEFAULT (strftime('%s','now')) NOT NULL
24+
`created_at` integer DEFAULT (strftime('%s','now') * 1000) NOT NULL,
25+
`updated_at` integer DEFAULT (strftime('%s','now') * 1000) NOT NULL
2626
);
2727
--> statement-breakpoint
2828
CREATE UNIQUE INDEX `projects_repo_path_unique` ON `projects` (`repo_path`);

drizzle/meta/0000_snapshot.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": "6",
33
"dialect": "sqlite",
4-
"id": "5f16745f-b3c0-44dc-b385-3dd2d6004bba",
4+
"id": "e47f2606-6bb2-4c81-a5fd-88be408a3905",
55
"prevId": "00000000-0000-0000-0000-000000000000",
66
"tables": {
77
"branches": {
@@ -34,15 +34,15 @@
3434
"primaryKey": false,
3535
"notNull": true,
3636
"autoincrement": false,
37-
"default": "(strftime('%s','now'))"
37+
"default": "(strftime('%s','now') * 1000)"
3838
},
3939
"updated_at": {
4040
"name": "updated_at",
4141
"type": "integer",
4242
"primaryKey": false,
4343
"notNull": true,
4444
"autoincrement": false,
45-
"default": "(strftime('%s','now'))"
45+
"default": "(strftime('%s','now') * 1000)"
4646
}
4747
},
4848
"indexes": {},
@@ -102,15 +102,15 @@
102102
"primaryKey": false,
103103
"notNull": true,
104104
"autoincrement": false,
105-
"default": "(strftime('%s','now'))"
105+
"default": "(strftime('%s','now') * 1000)"
106106
},
107107
"updated_at": {
108108
"name": "updated_at",
109109
"type": "integer",
110110
"primaryKey": false,
111111
"notNull": true,
112112
"autoincrement": false,
113-
"default": "(strftime('%s','now'))"
113+
"default": "(strftime('%s','now') * 1000)"
114114
}
115115
},
116116
"indexes": {},
@@ -163,15 +163,15 @@
163163
"primaryKey": false,
164164
"notNull": true,
165165
"autoincrement": false,
166-
"default": "(strftime('%s','now'))"
166+
"default": "(strftime('%s','now') * 1000)"
167167
},
168168
"updated_at": {
169169
"name": "updated_at",
170170
"type": "integer",
171171
"primaryKey": false,
172172
"notNull": true,
173173
"autoincrement": false,
174-
"default": "(strftime('%s','now'))"
174+
"default": "(strftime('%s','now') * 1000)"
175175
}
176176
},
177177
"indexes": {

drizzle/meta/_journal.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
{
66
"idx": 0,
77
"version": "6",
8-
"when": 1751816159018,
9-
"tag": "0000_whole_sandman",
8+
"when": 1751817573145,
9+
"tag": "0000_sudden_doomsday",
1010
"breakpoints": true
1111
}
1212
]

src/core/db/schema.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ export const projects = sqliteTable("projects", {
66
id: text("id").primaryKey(),
77
repoPath: text("repo_path").notNull().unique(),
88
repoName: text("repo_name").notNull(),
9-
createdAt: integer("created_at", { mode: "timestamp" })
9+
createdAt: integer("created_at", { mode: "timestamp_ms" })
1010
.notNull()
11-
.default(sql`(strftime('%s','now'))`),
12-
updatedAt: integer("updated_at", { mode: "timestamp" })
11+
.default(sql`(strftime('%s','now') * 1000)`),
12+
updatedAt: integer("updated_at", { mode: "timestamp_ms" })
1313
.notNull()
14-
.default(sql`(strftime('%s','now'))`),
14+
.default(sql`(strftime('%s','now') * 1000)`),
1515
});
1616

1717
export const branches = sqliteTable("branches", {
@@ -20,25 +20,25 @@ export const branches = sqliteTable("branches", {
2020
.notNull()
2121
.references(() => projects.id),
2222
name: text("name").notNull(),
23-
createdAt: integer("created_at", { mode: "timestamp" })
23+
createdAt: integer("created_at", { mode: "timestamp_ms" })
2424
.notNull()
25-
.default(sql`(strftime('%s','now'))`),
26-
updatedAt: integer("updated_at", { mode: "timestamp" })
25+
.default(sql`(strftime('%s','now') * 1000)`),
26+
updatedAt: integer("updated_at", { mode: "timestamp_ms" })
2727
.notNull()
28-
.default(sql`(strftime('%s','now'))`),
28+
.default(sql`(strftime('%s','now') * 1000)`),
2929
});
3030

3131
export const intents = sqliteTable("intents", {
3232
id: integer("id").primaryKey({ autoIncrement: true }),
3333
message: text("message").notNull(),
3434
status: text("status", { enum: INTENT_STATUS }).notNull(),
3535
branchId: text("branch_id").references(() => branches.id),
36-
createdAt: integer("created_at", { mode: "timestamp" })
36+
createdAt: integer("created_at", { mode: "timestamp_ms" })
3737
.notNull()
38-
.default(sql`(strftime('%s','now'))`),
39-
updatedAt: integer("updated_at", { mode: "timestamp" })
38+
.default(sql`(strftime('%s','now') * 1000)`),
39+
updatedAt: integer("updated_at", { mode: "timestamp_ms" })
4040
.notNull()
41-
.default(sql`(strftime('%s','now'))`),
41+
.default(sql`(strftime('%s','now') * 1000)`),
4242
});
4343

4444
export type Project = typeof projects.$inferSelect;

0 commit comments

Comments
 (0)