From 52408f3cbf1444d79afd0dbd2d4597d82772c687 Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Fri, 10 Apr 2020 14:22:18 -0700 Subject: [PATCH] test(postgres): make test_enum_type more resilient --- tests/postgres-derives.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/postgres-derives.rs b/tests/postgres-derives.rs index c23de309..975b00e1 100644 --- a/tests/postgres-derives.rs +++ b/tests/postgres-derives.rs @@ -78,20 +78,17 @@ async fn test_enum_type() -> anyhow::Result<()> { conn.execute( r#" -DO $$ BEGIN + +DROP TABLE IF EXISTS people; + +DROP TYPE IF EXISTS mood CASCADE; CREATE TYPE mood AS ENUM ( 'ok', 'happy', 'sad' ); -EXCEPTION - WHEN duplicate_object THEN null; -END $$; - -CREATE TABLE IF NOT EXISTS people ( +CREATE TABLE people ( id serial PRIMARY KEY, mood mood not null ); - -TRUNCATE people; "#, ) .await?;