Skip to content

Use incrementing PK by default on insert #89

Description

@Alanaktion

When inserting new rows into tables with PK integer columns, it defaults to 0/"numeric" for the column in the editor UI. To me it seems to make the most sense to use the "default" value on PK columns when inserting new records. Currently the "default" is only used when a default is set in the schema, but a PK should typically use the auto value for new records.

Implementation: in useEditorStore, the insert section could probably just add something like:

dataTypes: tableInfo.map(({ type, notnull, dflt_value, pk }): EditorDataType => {
    if (pk) {
        return "default"
    }
    ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions