simov / express-admin

MySQL, MariaDB, PostgreSQL, SQLite admin for Node.js
MIT License
1.17k stars 223 forks source link

boolean mapping to char #109

Open cercata opened 8 years ago

cercata commented 8 years ago

Why are boolean types maped to 'char' instead of 'boolean' ?

With the default express-admin, I get an error "out of range" when trying to edit a table that has a boolean.

If I set it to boolean in client.js, and I rebuild the settings.json file, It works like a charm.

https://github.com/simov/express-admin/blob/63a79ee86c3d5eacdcaba6f9d819022c8917529c/lib/db/client.js#L130

I'm using postgresql 9.4 don Debian 8.4 64 bits.

By the way, how could I make the default control for booleans a combo box ? I made it manually in settings.json and works like a charm.

lwiecek commented 5 years ago

true/false works for me as well (after changing defaults) but would it be possible to get a null?

Currently radio only shows true/false.

I looked at https://github.com/simov/express-admin/issues/22 and it wasn't mentioned.

I'm using nullable boolean to keep track of running or completed job status.

{
    "name": "success",
    "verbose": "success",
    "control": {
        "radio": true,
        "options": [
            true,
            false,
            null
        ]
    },
    "type": "boolean",
    "allowNull": true,
    "defaultValue": null,
    "listview": {
        "show": true
    },
    "editview": {
        "show": true
    }
},