public function setModel(\atk4\data\Model $m)
    {
        $this->table($m->table);

        foreach ($m->elements as $field) {
            // ignore not persisted model fields
            if (!$field instanceof \atk4\data\Field) {
                continue;
            }

            if ($field->never_persist) {
                continue;
            }

            if ($field instanceof \atk4\data\Field_SQL_Expression) {
                continue;
            }

            if ($field->short_name == $m->id_field) {
                $this->id($field->actual ?: $field->short_name);
                continue;
            }

            $this->field($field->actual ?: $field->short_name, ['type' => $field->type]);  // todo add more options here
        }

        return $m;
    }