-
-
Notifications
You must be signed in to change notification settings - Fork 180
release v0.5.2 #675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release v0.5.2 #675
Changes from all commits
090d5e4
3414457
704d00a
0ee84dd
1ddd908
4dd3766
8160704
10662c8
6543af8
2d6b89b
cdd6fe7
ebd957e
01f18ab
c8920e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| -- Add timezone column to system_settings table | ||
| -- Stores IANA timezone identifier (e.g., 'Asia/Shanghai', 'America/New_York') | ||
| -- NULL means: use TZ environment variable or fallback to UTC | ||
|
|
||
| ALTER TABLE "system_settings" | ||
| ADD COLUMN IF NOT EXISTS "timezone" varchar(64); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| ALTER TABLE "message_request" ALTER COLUMN "input_tokens" SET DATA TYPE bigint;--> statement-breakpoint | ||
| ALTER TABLE "message_request" ALTER COLUMN "output_tokens" SET DATA TYPE bigint;--> statement-breakpoint | ||
| ALTER TABLE "message_request" ALTER COLUMN "cache_creation_input_tokens" SET DATA TYPE bigint;--> statement-breakpoint | ||
| ALTER TABLE "message_request" ALTER COLUMN "cache_read_input_tokens" SET DATA TYPE bigint;--> statement-breakpoint | ||
| ALTER TABLE "message_request" ALTER COLUMN "cache_creation_5m_input_tokens" SET DATA TYPE bigint;--> statement-breakpoint | ||
| ALTER TABLE "message_request" ALTER COLUMN "cache_creation_1h_input_tokens" SET DATA TYPE bigint; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| ALTER TABLE "system_settings" ADD COLUMN "quota_db_refresh_interval_seconds" integer DEFAULT 10;--> statement-breakpoint | ||
| ALTER TABLE "system_settings" ADD COLUMN "quota_lease_percent_5h" numeric(5, 4) DEFAULT '0.05';--> statement-breakpoint | ||
| ALTER TABLE "system_settings" ADD COLUMN "quota_lease_percent_daily" numeric(5, 4) DEFAULT '0.05';--> statement-breakpoint | ||
| ALTER TABLE "system_settings" ADD COLUMN "quota_lease_percent_weekly" numeric(5, 4) DEFAULT '0.05';--> statement-breakpoint | ||
| ALTER TABLE "system_settings" ADD COLUMN "quota_lease_percent_monthly" numeric(5, 4) DEFAULT '0.05';--> statement-breakpoint | ||
| ALTER TABLE "system_settings" ADD COLUMN "quota_lease_cap_usd" numeric(10, 2); |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,2 @@ | ||||||||||||
| ALTER TABLE "keys" ALTER COLUMN "expires_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint | ||||||||||||
| ALTER TABLE "system_settings" ADD COLUMN IF NOT EXISTS "timezone" varchar(64); | ||||||||||||
|
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cd /root && find . -name "0059_safe_xorn.sql" -type f 2>/dev/null | head -5Repository: ding113/claude-code-hub Length of output: 122 🏁 Script executed: find . -path "*/drizzle/*" -name "*.sql" -type f 2>/dev/null | head -20Repository: ding113/claude-code-hub Length of output: 802 🏁 Script executed: find . -name "*.sql" -path "*drizzle*" 2>/dev/null | sortRepository: ding113/claude-code-hub Length of output: 2353 🏁 Script executed: cat -n ./drizzle/0059_safe_xorn.sqlRepository: ding113/claude-code-hub Length of output: 268 🏁 Script executed: cat -n ./drizzle/0048_add_system_timezone.sqlRepository: ding113/claude-code-hub Length of output: 377 🌐 Web query:
💡 Result: In PostgreSQL:
What happens when you cast?
|
||||||||||||
| ALTER TABLE "keys" ALTER COLUMN "expires_at" SET DATA TYPE timestamp with time zone;--> statement-breakpoint | |
| ALTER TABLE "system_settings" ADD COLUMN IF NOT EXISTS "timezone" varchar(64); | |
| ALTER TABLE "keys" ALTER COLUMN "expires_at" SET DATA TYPE timestamp with time zone | |
| USING "expires_at" AT TIME ZONE 'UTC';--> statement-breakpoint | |
| ALTER TABLE "system_settings" ADD COLUMN IF NOT EXISTS "timezone" varchar(64); |
🤖 Prompt for AI Agents
In `@drizzle/0059_safe_xorn.sql` around lines 1 - 2, 在将 keys 表的 expires_at 列从
timestamp 转为 timestamp with time zone 时,明确在 ALTER TABLE ... ALTER COLUMN
"expires_at" SET DATA TYPE 子句中添加 USING 子句,把现有的 timestamp 值按 UTC 解释后再转为带时区的时间(即使用
expires_at AT TIME ZONE 'UTC' 之类的表达式),以避免会话时区导致的时间偏移;更新相应的 ALTER TABLE "keys"
ALTER COLUMN "expires_at" 语句并保留对 system_settings 表新增 timezone 列的变更。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify existing expires_at timestamps convert correctly to timestamptz - PostgreSQL will interpret them as being in server timezone. Test with: SELECT timezone('UTC', expires_at) FROM keys WHERE expires_at IS NOT NULL LIMIT 10;
Prompt To Fix With AI
This is a comment left during a code review.
Path: drizzle/0059_safe_xorn.sql
Line: 1:2
Comment:
Verify existing `expires_at` timestamps convert correctly to `timestamptz` - PostgreSQL will interpret them as being in server timezone. Test with: `SELECT timezone('UTC', expires_at) FROM keys WHERE expires_at IS NOT NULL LIMIT 10;`
How can I resolve this? If you propose a fix, please make it concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
ADD COLUMNstatement for thetimezonecolumn appears to be redundant. The same column is also added in migration0048_add_system_timezone.sql. WhileIF NOT EXISTSprevents an error during execution, having duplicate schema modifications across different migration files can lead to confusion and potential issues with manual rollbacks or out-of-order execution. It would be cleaner to remove this line to ensure each schema change is declared only once.