fixed #1039 - first DB migration failing on Postgres

This commit is contained in:
Eugene 2024-11-28 22:12:03 +01:00
parent 379b1bc5e9
commit 41d3158cbf
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4

View file

@ -1,4 +1,4 @@
use sea_orm::Schema; use sea_orm::{DbBackend, Schema};
use sea_orm_migration::prelude::*; use sea_orm_migration::prelude::*;
pub mod ticket { pub mod ticket {
@ -42,13 +42,15 @@ impl MigrationTrait for Migration {
.create_table(schema.create_table_from_entity(ticket::Entity)) .create_table(schema.create_table_from_entity(ticket::Entity))
.await?; .await?;
// https://github.com/warp-tech/warpgate/issues/857 let connection = manager.get_connection();
let _ = manager if connection.get_database_backend() == DbBackend::MySql {
.get_connection() // https://github.com/warp-tech/warpgate/issues/857
.execute_unprepared( connection
"ALTER TABLE `tickets` MODIFY COLUMN `expiry` TIMESTAMP NULL DEFAULT NULL", .execute_unprepared(
) "ALTER TABLE `tickets` MODIFY COLUMN `expiry` TIMESTAMP NULL DEFAULT NULL",
.await; )
.await?;
}
Ok(()) Ok(())
} }