Skip to content

Commit fda3117

Browse files
authored
fix: Create enum only for tests (#12)
1 parent aaba224 commit fda3117

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/db/postgres.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,29 +99,20 @@ impl PostgresDatabase {
9999

100100
let db = PostgresDatabase { pool, schema, mode };
101101

102-
// If a schema is specified, create it and the tables
103102
if let Some(ref schema_name) = db.schema {
104103
db.initialize_schema(schema_name).await?;
105-
} else {
106-
// Create enum in public schema if no specific schema is provided
107-
db.ensure_enum_exists().await?;
108104
}
109105

110106
info!("PostgreSQL database connection established successfully");
111107
Ok(db)
112108
}
113109

114-
/// Ensure the enum type exists in the public schema
115-
async fn ensure_enum_exists(&self) -> Result<(), DatabaseError> {
116-
self.create_enum_type(None).await
117-
}
118-
119110
/// Initialize a schema with the required tables
120111
async fn initialize_schema(&self, schema_name: &str) -> Result<(), DatabaseError> {
121112
info!("Initializing schema: {schema_name}");
122113

123114
// First ensure the enum exists in public schema (needed for type casting)
124-
self.ensure_enum_exists().await?;
115+
self.create_enum_type(None).await?;
125116

126117
// Create schema if it doesn't exist
127118
let create_schema_query = format!("CREATE SCHEMA IF NOT EXISTS {schema_name}");

0 commit comments

Comments
 (0)