000026_create_preferences_table.up.sql
TLDR
This file creates a SQL table called preferences
if it doesn't exist already. The table has columns for userid
, category
, name
, and value
, with a primary key on the userid
, category
, and name
.
Methods
None
Classes
None
CREATE TABLE IF NOT EXISTS {{.prefix}}preferences
(
userid VARCHAR(36) NOT NULL,
category VARCHAR(32) NOT NULL,
name VARCHAR(32) NOT NULL,
value TEXT NULL,
PRIMARY KEY (userid, category, name)
) {{if .mysql}}DEFAULT CHARACTER SET utf8mb4{{end}};
{{- /* createIndexIfNeeded tableName columns */ -}}
{{ createIndexIfNeeded "preferences" "category" }}
{{ createIndexIfNeeded "preferences" "name" }}