Skip to content

SQLite Support

Compare
Choose a tag to compare
@simov simov released this 08 Feb 23:39
· 216 commits to main since this release

Install the SQLite bindings

Like with PostgreSQL you need to install the SQLite bindings separately

# SQLite only: run this inside the express-admin folder
$ npm install [email protected]

The module used is https://github.com/mapbox/node-sqlite3 and it's outlined inside the documentation as well http://simov.github.io/express-admin-site/#install

Creating new project

  • When prompted for Database type: type sqlite
  • When prompted for Database name: type the /absolute/path/to/your/database.sqlite

Auto incrementing primary keys

Since SQLite has its own build in auto incrementing id field called rowid you can configure your project to use them like this:

  • add this id column definition inside your table's columns array
"columns": [
    {
        "verbose": "id",
        "name": "rowid",
        "control": {
            "text": true
        },
        "type": "int(11)",
        "allowNull": false,
        "defaultValue": null,
        "listview": {
            "show": false
        },
        "editview": {
            "show": false
        }
    },
    ...
]
  • Inside the table key set the primary key to be the rowid of the table
"table": {
    "name": "...",
    "pk": "rowid",
    "verbose": "..."
}

Pull the latest examples from https://github.com/simov/express-admin-examples/ and see how it's done there