Search code examples
haskellopaleye

Can Haskell's Opaleye DSL generate any given SQL?


My team uses Opaleye to query Postgres from Haskell.

However, we also use raw SQL to do such things as:

  • Initialize the database. Including commands create database and create table

  • Perform database migrations when we change our schema, including varied commands.

Is it possible to entirely replace this raw SQL code with Opaleye?

Can Opaleye replace any SQL?


Solution

  • According to the Opaleye tutorial, creating tables and databases is currently unsupported:

    Opaleye assumes that a Postgres database already exists. Currently there is no support for creating databases or tables, though these features may be added later according to demand.