def create_view(name, version: nil, sql_definition: nil, materialized: false)
      if version.present? && sql_definition.present?
        raise(
          ArgumentError,
          "sql_definition and version cannot both be set"
        )
      end

      if version.blank? && sql_definition.blank?
        version = 1
      end

      sql_definition ||= definition(name, version)

      if materialized
        options = materialized_options(materialized)

        Scenic.database.create_materialized_view(
          name,
          sql_definition,
          no_data: options[:no_data]
        )
      else
        Scenic.database.create_view(name, sql_definition)
      end
    end
Create a new database view.

@param name [String, Symbol] The name of the database view.
@param version [Fixnum] The version number of the view, used to find the
definition file in `db/views`. This defaults to `1` if not provided.
@param sql_definition [String] The SQL query for the view schema. An error
will be raised if `sql_definition` and `version` are both set,
as they are mutually exclusive.
@param materialized [Boolean, Hash] Set to a truthy value to create a
materialized view. Hash
@option materialized [Boolean] :no_data (false) Set to true to create
materialized view without running the associated query. You will need
to perform a non-concurrent refresh to populate with data.
@return The database response from executing the create statement.

@example Create from `db/views/searches_v02.sql`
create_view(:searches, version: 2)

@example Create from provided SQL string
create_view(:active_users, sql_definition: <<-SQL)
SELECT * FROM users WHERE users.active = 't'
SQL