Is Enum available in Sqlite?

SQLite does NOT have a native ENUM data type like some other database systems such as MySQL. However, you can simulate enums in SQLite using a combination of a CHECK constraint and a TEXT or INTEGER column.

Here’s an example using a TEXT column:

CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    status TEXT CHECK (status IN ('active', 'inactive', 'pending')
)

If you need to add new values to your “enum” or update the values later, you can use an ALTER TABLE statement to modify the CHECK constraint. Here’s an example of how you might do that:

ALTER TABLE users ADD COLUMN status TEXT CHECK (status IN ('active', 'inactive', 'pending', 'blocked'))