datasette / datasette-write-ui

A Datasette plugin that adds UI elements to edit, insert, or delete rows in SQLite tables
Apache License 2.0
16 stars 3 forks source link

NULL-able Columns #9

Open asg017 opened 1 year ago

asg017 commented 1 year ago

For null-able columns, each field should include a new "null" checkbox. If checked, the corresponding input (textarea, range slider, etc) should be hidden, and the value should be defaulted to NULL. If it is not check, the input element should be shown and whatever value there should take precedence.

For NOT NULL columns, the checkbox shouldn't even show up.

simonw commented 1 year ago

In horrifying news, TIL that SQLite allows nulls in primary keys!

I'm working through the consequences of that for Datasette here:

simonw commented 1 year ago

I don't think datasette-write-ui should allow a primary key to be set to null - that's very much not something that SQLite is proud of:

But it should ideally allow people to edit their null primary keys to fix them by setting them to something not-null.

Although it doesn't have the ability to edit primary keys at all, so maybe we just ignore this issue?