SET @users_permissions_exists := (
  SELECT COUNT(*)
  FROM information_schema.columns
  WHERE table_schema = DATABASE()
    AND table_name = 'users'
    AND column_name = 'permissions'
);
SET @users_permissions_sql := IF(
  @users_permissions_exists = 0,
  'ALTER TABLE users ADD COLUMN permissions JSON NULL AFTER must_change_password',
  'SELECT 1'
);
PREPARE users_permissions_stmt FROM @users_permissions_sql;
EXECUTE users_permissions_stmt;
DEALLOCATE PREPARE users_permissions_stmt;
