Hasura v1.0.0-beta.6 Release Notes

Release Date: 2019-08-29 // over 4 years ago
  • 🔄 Changelog

    EDIT(10-Sept): Breaking change

    🚀 A minor breaking change with this release has been identified; some type names have been modified to make them more consistent with others. Here's a list of modified type-names:

    • integer_comparison_exp -> Int_comparison_exp
    • boolean_comparison_exp -> Boolean_comparison_exp
    • real_comparison_exp -> Float_comparison_exp
    • text_comparison_exp -> String_comparison_exp
    • varchar_comparison_exp -> String_comparison_exp

    👌 Support for GraphQL Enums

    📚 Single-column Postgres tables (or two-columns, where the second column is a documentation comment) can now be exposed as Enums in the GraphQL schema so that enum values can be explicitly represented and typechecked.

    Creating Enums

    🔧 Here's how you can configure Enums:

    📇 🎛 Using metadata APIs

    ➕ 1. Adding a new table as Enums : An optional is_enum key has been added to the track_table metadata API that lets you specify that a table is to be exposed as an Enum.

    1. Setting an existing tracked table as Enum : A new set_table_is_enum metadata API allows specifying whether an already-tracked table should be used as an Enum table.
    🍱 🖥 Using the console

    ➕ 1. Adding a new table as Enums

    • Create a table as usual (the table must have only 1 or 2 columns) and add some data in it:
      Let's say we want to create an Enum for months of the year:

      CREATE TABLE months_of_the_year ( month text PRIMARY KEY, description text );

    ✅ Let's also add some test data into this table:

    INSERT INTO months\_of\_the\_year (month, comment) VALUES('January', 'named after the Latin word for door (ianua)'), ('February', 'named after the Latin term februum, which means purification')
    
    • Head to the Modify section for the table and toggle the Set table as enum option and confirm.
      1. Exposing an existing tracked table as Enum
    • Head to the Modify section for the table and toggle the Set table as enum option and confirm.

    Modify-section-enum-option

    Note : The GraphQL Spec mandates that you not have empty Enum lists (in this case, tables). Using any of the above methods with empty tables will result in an error.

    Using Enums

    1. To restrict values for a column in a table to those from an enum, first, you need to set up a foreign key to the column of the enum table with the enum values ⚡️ 2. If the enum table has been tracked and set as an enum table, the GraphQL schema will be updated to reflect Enums and the references to it in tables:

      type rain_log { id: Int!rainfall: Numeric!month: months_of_the_year_enum! } enum months_of_the_year_enum { "named after the Latin word for door (ianua)" January"named after the Latin term februum, which means purification" February }

    2. If you head to Graphiql, you'll notice that:

      • you can pick the enum value in Explorer from a drop-down
      • you can use the name of the enum value directly rather than providing a string

    enums_in_mutations_and_explorer

    🍱 🧭 🗺 Support for Raster ST_Intersect functions

    📄 Some of the overloaded variants of the PostGIS raster ST_Intersects function are now available as the following GraphQL operators for raster columns in boolean expressions:

    1. _st_intersects_rast -> boolean ST_Intersects(raster <raster-col>, raster <raster-input>)
    2. _st_intersects_nband_geom -> boolean ST_Intersects(raster <raster-col>, integer nband, geometry geommin)
    3. _st_intersects_geom_nband -> boolean ST_Intersects(raster <raster-col> , geometry geommin, integer nband=NULL) (with and without nband values)

    Usage:

    query ($raster\_input: raster) { table\_with\_raster\_col(where: {rast\_col: {\_st\_intersects\_rast: $raster\_input}}){ idrast\_col } }
    

    Note: raster_input is a raw String value of raster data.

    👀 Please see docs for more details.

    🛠️ Bug Fixes and other changes

    📄 The server now uses named notation instead of positional notation for function arguments to prevent issues with the generated SQL if any of the arguments is not specified. (fix #2730) (#2777)

    🍱 The server now shuts down gracefully for HTTP requests i.e. it stops accepting new connections, waits for all connections to be drained before shutting down. It also forcefully kills all pending connections after 30 seconds. This change does not deal with gracefully shutting down websocket connections, something that will be handled in a subsequent PR. 📣 Shoutout to @lorenzo for submitting this PR 🙏 🎉 (close #2698) (#2717)

    🛠 Minor fixes in console & CLI (#2527, #2536, #2798, #2765, #2763, #2617)