Name
Columns
Name
Type
Primary
{#each values.columns as column, i}
column.datatype, (v) => { column.datatype = v if (datatypeHasLength(column.datatype)) { column.datatype_length = datatypeDefaultLength(column.datatype) } else { column.datatype_length = undefined } } } items={columnTypes.map((type) => ({ value: type, label: type }))} class="w-48" />
{#snippet trigger()}
{/snippet} {#snippet content()} {#if datatypeHasLength(column.datatype)}
Length
{/if}
Default value
{#snippet text()} Surround your expressions with curly brackets:
{'{NOW()}'}
.
By default, it will be parsed as a literal {/snippet}
{#if !column.primaryKey}
Not nullable
{/if} {/snippet}
values.columns.splice(i, 1)} />
{/each}
addColumn({ name: '' })} > Add
Foreign Keys
Table
Columns
{#each values.foreignKeys as foreignKey, foreignKeyIndex} {@const fkErrors = errors?.foreignKeys?.[foreignKeyIndex]}
({ value: o, label: (currentSchema && o.startsWith(currentSchema)) || !dbSupportsSchemas(resourceType) ? o.split('.')[1] : o }))} clearable={false} />
{#each foreignKey.columns as column, columnIndex}
c.name.length) .map((c) => ({ value: c.name }))} clearable={false} />
({ value }))} clearable={false} />
{#if columnIndex === 0}
{#snippet trigger()}
{/snippet} {#snippet content()}
ON DELETE
NO ACTION
CASCADE
SET NULL
ON UPDATE
NO ACTION
CASCADE
SET NULL
{/snippet}
{/if}
1 ? () => foreignKey.columns.splice(columnIndex, 1) : () => values.foreignKeys.splice(foreignKeyIndex, 1)} />
{/each}
foreignKey.columns.push({})} >
Add
{/each}
values.foreignKeys.push({ columns: [{}], onDelete: 'NO ACTION', onUpdate: 'NO ACTION' })} > Add
(askingForConfirmation = { onConfirm: async () => { try { askingForConfirmation && (askingForConfirmation.loading = true) await onConfirm(values) sendUserToast(values.name + ' created!') } catch (e) { let msg: string | undefined = (e as Error)?.message if (typeof msg !== 'string') msg = e ? JSON.stringify(e) : 'An error occurred' sendUserToast(msg, true) } askingForConfirmation = undefined }, title: 'Confirm running the following:', confirmationText: 'Create ' + values.name, open: true, ...(previewSql && { codeContent: previewSql(values) }) })}>Create table
(askingForConfirmation = undefined)} on:confirmed={askingForConfirmation?.onConfirm ?? (() => {})} > {#if askingForConfirmation?.codeContent}
{askingForConfirmation.codeContent}
copyToClipboard(askingForConfirmation?.codeContent)} size="xs" startIcon={{ icon: ClipboardCopy }} color="none" wrapperClasses="absolute z-10 top-0 right-0" >
{/if}