-
Notifications
You must be signed in to change notification settings - Fork 595
Fix/normalized tables type bug #521
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
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.
PR Summary
Changes database schema to fix typing issues in workflow block positioning by converting position_x, position_y, and height columns from integer to numeric type in the workflow_blocks table.
- Modifies
apps/sim/db/schema.ts
to use decimal types for positionX, positionY and height fields - Updates
apps/sim/lib/workflows/db-helpers.ts
to properly convert between string DB fields and numeric application values - Adds migration
0044_uneven_killer_shrike.sql
to safely convert existing data to new numeric format - Sets default value of '0' for height column to ensure data consistency
5 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile
ALTER TABLE "workflow_blocks" ALTER COLUMN "position_x" SET DATA TYPE numeric;--> statement-breakpoint | ||
ALTER TABLE "workflow_blocks" ALTER COLUMN "position_y" SET DATA TYPE numeric;--> statement-breakpoint | ||
ALTER TABLE "workflow_blocks" ALTER COLUMN "height" SET DATA TYPE numeric;--> statement-breakpoint | ||
ALTER TABLE "workflow_blocks" ALTER COLUMN "height" SET DEFAULT '0'; |
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.
logic: Using string '0' as default for numeric column is inconsistent. Should be numeric literal 0 without quotes
ALTER TABLE "workflow_blocks" ALTER COLUMN "height" SET DEFAULT '0'; | |
ALTER TABLE "workflow_blocks" ALTER COLUMN "height" SET DEFAULT 0; |
positionX: String(block.position?.x || 0), | ||
positionY: String(block.position?.y || 0), |
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.
style: Position values should be rounded before String conversion to prevent floating point precision issues
…ai/sim into fix/normalized-tables-type-bug
Description
Typing change to fix lint.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Checklist:
bun run test
)Security Considerations:
Additional Information:
Any additional information, configuration or data that might be necessary to reproduce the issue or use the feature.