mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-28 16:09:17 +00:00
fix(grid): exclude columns with defaults from NOT NULL validation
The save validator rejected NULL in NOT NULL columns even when the column has a DEFAULT (e.g. serial/sequence). Skip those columns so cloned rows with auto-increment PKs pass frontend validation.
This commit is contained in:
@@ -13,6 +13,7 @@ export interface DataGridTableMeta {
|
||||
export interface DataGridColumnInfo {
|
||||
name: string;
|
||||
is_nullable: boolean;
|
||||
column_default?: string | null;
|
||||
}
|
||||
|
||||
export interface DataGridSaveStatementOptions {
|
||||
@@ -36,7 +37,9 @@ export interface DataGridSaveValidationOptions {
|
||||
export function validateDataGridSave(options: DataGridSaveValidationOptions): string | undefined {
|
||||
const notNullColumns = new Set(
|
||||
(options.columnInfo ?? [])
|
||||
.filter((column) => !column.is_nullable && !isOracleRowId(options.databaseType, column.name))
|
||||
.filter(
|
||||
(column) => !column.is_nullable && !column.column_default && !isOracleRowId(options.databaseType, column.name),
|
||||
)
|
||||
.map((column) => normalizeColumnName(column.name)),
|
||||
);
|
||||
if (notNullColumns.size === 0) return undefined;
|
||||
|
||||
Reference in New Issue
Block a user