From 03ba5ca4340d648564981c8adbc0fd88376d1d7e Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Mon, 18 May 2020 20:09:51 -0700 Subject: [PATCH] I think postgres needs this --- tests/postgres-derives.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/postgres-derives.rs b/tests/postgres-derives.rs index ae800d21..9085a5af 100644 --- a/tests/postgres-derives.rs +++ b/tests/postgres-derives.rs @@ -30,6 +30,7 @@ enum Strong { // rename_all variants #[derive(PartialEq, Debug, sqlx::Type)] +#[sqlx(rename = "color_lower")] #[sqlx(rename_all = "lowercase")] enum ColorLower { Red, @@ -37,12 +38,14 @@ enum ColorLower { Blue, } #[derive(PartialEq, Debug, sqlx::Type)] +#[sqlx(rename = "color_snake")] #[sqlx(rename_all = "snake_case")] enum ColorSnake { RedGreen, BlueBlack, } #[derive(PartialEq, Debug, sqlx::Type)] +#[sqlx(rename = "color_upper")] #[sqlx(rename_all = "uppercase")] enum ColorUpper { Red, @@ -123,6 +126,14 @@ DROP TYPE IF EXISTS mood CASCADE; CREATE TYPE mood AS ENUM ( 'ok', 'happy', 'sad' ); +DROP TYPE IF EXISTS color_lower CASCADE; +DROP TYPE IF EXISTS color_snake CASCADE; +DROP TYPE IF EXISTS color_upper CASCADE; + +CREATE TYPE color_lower AS ENUM ( 'red', 'green', 'blue' ); +CREATE TYPE color_snake AS ENUM ( 'red_green', 'blue_black' ); +CREATE TYPE color_upper AS ENUM ( 'RED', 'GREEN', 'BLUE' ); + CREATE TABLE people ( id serial PRIMARY KEY, mood mood not null