mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-24 16:01:42 +00:00
Merge branch 'main' into tl/app-builder
This commit is contained in:
@@ -65,6 +65,7 @@ When generating code, especially involving `serde`, `sqlx`, and `tokio`, priorit
|
||||
|
||||
### SQLx Optimizations (Database Interaction)
|
||||
|
||||
- **CRITICAL - Never Use `SELECT *` in Worker-Executed Queries:** For any query that can potentially be executed by workers, **always** explicitly list the specific columns you need instead of using `SELECT *`. This is essential for backwards compatibility: when workers are running behind the API server version (common in distributed deployments), adding new columns to database tables will cause outdated workers to fail when they try to deserialize rows with unexpected columns. Always use explicit column lists like `SELECT id, workspace_id, path, created_at FROM table` instead of `SELECT * FROM table`.
|
||||
- **Select Only Necessary Columns:** In `SELECT` queries, list specific column names rather than using `SELECT *`. This reduces data transferred from the database and the work needed for hydration/deserialization.
|
||||
- **Batch Operations:** For multiple `INSERT`, `UPDATE`, or `DELETE` statements, prefer executing them in a single query if the database and driver support it efficiently (e.g., `INSERT INTO ... VALUES (...), (...), ...`). This minimizes round trips to the database.
|
||||
- **Avoid N+1 Queries:** Do not loop through results of one query and execute a separate query for each item (e.g., fetching users, then querying for each user's profile in a loop). Instead, use JOINs or a single query with an `IN` clause to fetch related data efficiently.
|
||||
|
||||
@@ -492,12 +492,18 @@
|
||||
if (typeof newSchemaRes === 'string') {
|
||||
const resourcePath = newSchemaRes.replace('$res:', '')
|
||||
dbSchema = $dbSchemas[resourcePath]
|
||||
if (lang === 'graphql' && dbSchema === undefined) {
|
||||
await getDbSchemas(lang, resourcePath, $workspaceStore, $dbSchemas, (e) => {
|
||||
console.error('error getting graphql db schema', e)
|
||||
})
|
||||
dbSchema = $dbSchemas[resourcePath]
|
||||
if (dbSchema === undefined) {
|
||||
if (lang === 'graphql') {
|
||||
await getDbSchemas('graphql', resourcePath, $workspaceStore, $dbSchemas, (e) => {
|
||||
console.error('error getting graphql db schema', e)
|
||||
})
|
||||
} else if (lang === 'sql') {
|
||||
await getDbSchemas(scriptLang ?? '', resourcePath, $workspaceStore, $dbSchemas, (e) => {
|
||||
console.error(`error getting SQL (${scriptLang}) db schema`, e)
|
||||
})
|
||||
}
|
||||
}
|
||||
dbSchema = $dbSchemas[resourcePath]
|
||||
} else {
|
||||
dbSchema = undefined
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
import type { PropPickerWrapperContext } from './flows/propPicker/PropPickerWrapper.svelte'
|
||||
import { codeToStaticTemplate, getDefaultExpr } from './flows/utils'
|
||||
import SimpleEditor from './SimpleEditor.svelte'
|
||||
import { Button } from '$lib/components/common'
|
||||
import { Button, ButtonType } from '$lib/components/common'
|
||||
import ToggleButtonGroup from '$lib/components/common/toggleButton-v2/ToggleButtonGroup.svelte'
|
||||
import ToggleButton from '$lib/components/common/toggleButton-v2/ToggleButton.svelte'
|
||||
import { tick } from 'svelte'
|
||||
@@ -553,9 +553,10 @@
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<div>
|
||||
<div class="{ButtonType.UnifiedHeightClasses.sm} relative">
|
||||
<ToggleButtonGroup
|
||||
selected={propertyType}
|
||||
class="h-full"
|
||||
on:selected={(e) => {
|
||||
if (e.detail == propertyType) return
|
||||
const staticTemplate = isStaticTemplate(inputCat)
|
||||
|
||||
@@ -69,6 +69,9 @@
|
||||
unifiedHeight ? ButtonType.UnifiedHeightClasses[size] : '',
|
||||
className
|
||||
)}
|
||||
onpointerdown={(e) => {
|
||||
e.stopImmediatePropagation()
|
||||
}}
|
||||
bind:this={inputEl}
|
||||
bind:value
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user