Merge pull request #13752 from Budibase/BUDI-8279/prevent-changing-date-or-time-only-when-fetched
Prevent changing date or time only when fetched
This commit is contained in:
commit
7d77b517be
|
@ -604,27 +604,29 @@
|
||||||
<DatePicker bind:value={editableColumn.constraints.datetime.latest} />
|
<DatePicker bind:value={editableColumn.constraints.datetime.latest} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#if datasource?.source !== SourceName.ORACLE && datasource?.source !== SourceName.SQL_SERVER && !editableColumn.dateOnly}
|
{#if !editableColumn.timeOnly}
|
||||||
<div>
|
{#if datasource?.source !== SourceName.ORACLE && datasource?.source !== SourceName.SQL_SERVER && !editableColumn.dateOnly}
|
||||||
<div class="row">
|
<div>
|
||||||
<Label>Time zones</Label>
|
<div class="row">
|
||||||
<AbsTooltip
|
<Label>Time zones</Label>
|
||||||
position="top"
|
<AbsTooltip
|
||||||
type="info"
|
position="top"
|
||||||
text={isCreating
|
type="info"
|
||||||
? null
|
text={isCreating
|
||||||
: "We recommend not changing how timezones are handled for existing columns, as existing data will not be updated"}
|
? null
|
||||||
>
|
: "We recommend not changing how timezones are handled for existing columns, as existing data will not be updated"}
|
||||||
<Icon size="XS" name="InfoOutline" />
|
>
|
||||||
</AbsTooltip>
|
<Icon size="XS" name="InfoOutline" />
|
||||||
|
</AbsTooltip>
|
||||||
|
</div>
|
||||||
|
<Toggle
|
||||||
|
bind:value={editableColumn.ignoreTimezones}
|
||||||
|
text="Ignore time zones"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Toggle
|
{/if}
|
||||||
bind:value={editableColumn.ignoreTimezones}
|
<Toggle bind:value={editableColumn.dateOnly} text="Date only" />
|
||||||
text="Ignore time zones"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
<Toggle bind:value={editableColumn.dateOnly} text="Date only" />
|
|
||||||
{:else if editableColumn.type === FieldType.NUMBER && !editableColumn.autocolumn}
|
{:else if editableColumn.type === FieldType.NUMBER && !editableColumn.autocolumn}
|
||||||
<div class="split-label">
|
<div class="split-label">
|
||||||
<div class="label-length">
|
<div class="label-length">
|
||||||
|
|
|
@ -73,6 +73,16 @@ function validate(table: Table, oldTable?: Table) {
|
||||||
`Column "${key}" has subtype "${column.subtype}" - this is not supported.`
|
`Column "${key}" has subtype "${column.subtype}" - this is not supported.`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (column.type === FieldType.DATETIME) {
|
||||||
|
const oldColumn = oldTable?.schema[key] as typeof column
|
||||||
|
|
||||||
|
if (oldColumn && column.timeOnly !== oldColumn.timeOnly) {
|
||||||
|
throw new Error(
|
||||||
|
`Column "${key}" can not change from time to datetime or viceversa.`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue