Skip to content

Commit

Permalink
I think postgres needs this
Browse files Browse the repository at this point in the history
  • Loading branch information
phated authored and abonander committed May 21, 2020
1 parent 2ffbe2f commit 03ba5ca
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/postgres-derives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,22 @@ enum Strong {

// rename_all variants
#[derive(PartialEq, Debug, sqlx::Type)]
#[sqlx(rename = "color_lower")]
#[sqlx(rename_all = "lowercase")]
enum ColorLower {
Red,
Green,
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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 03ba5ca

Please sign in to comment.