SQL
CREATE TABLE users (
id TEXT PRIMARY KEY,
email TEXT UNIQUE NOT NULL,
password_hash TEXT NOT NULL,
organisation_id TEXT,
role TEXT DEFAULT 'member',
email_verified INTEGER DEFAULT 0,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (organisation_id) REFERENCES organisations(id) ON DELETE SET NULL
)
Columns
| Column | Data type | Allow null | Primary key | Actions |
|---|---|---|---|---|
id |
TEXT |
✓ | ✓ | Rename | Drop |
email |
TEXT |
Rename | Drop | ||
password_hash |
TEXT |
Rename | Drop | ||
organisation_id |
TEXT |
✓ | Rename | Drop | |
role |
TEXT |
✓ | Rename | Drop | |
email_verified |
INTEGER |
✓ | Rename | Drop | |
created_at |
DATETIME |
✓ | Rename | Drop | |
updated_at |
DATETIME |
✓ | Rename | Drop |
Foreign Keys
| Column | Destination |
|---|---|
organisation_id |
organisations.id |
Indexes
| Name | Columns | Unique | SQL | Drop? |
|---|---|---|---|---|
| idx_users_email |
email
|
SQL | Drop | |
| idx_users_organisation_id |
organisation_id
|
SQL | Drop | |
| sqlite_autoindex_users_1 |
id
|
✓ | SQL | Drop |
| sqlite_autoindex_users_2 |
email
|
✓ | SQL | Drop |