mirror of
https://github.com/warp-tech/warpgate.git
synced 2025-09-08 23:54:23 +08:00
fixed #1039 - first DB migration failing on Postgres
This commit is contained in:
parent
379b1bc5e9
commit
41d3158cbf
1 changed files with 10 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
|||
use sea_orm::Schema;
|
||||
use sea_orm::{DbBackend, Schema};
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub mod ticket {
|
||||
|
@ -42,13 +42,15 @@ impl MigrationTrait for Migration {
|
|||
.create_table(schema.create_table_from_entity(ticket::Entity))
|
||||
.await?;
|
||||
|
||||
// https://github.com/warp-tech/warpgate/issues/857
|
||||
let _ = manager
|
||||
.get_connection()
|
||||
.execute_unprepared(
|
||||
"ALTER TABLE `tickets` MODIFY COLUMN `expiry` TIMESTAMP NULL DEFAULT NULL",
|
||||
)
|
||||
.await;
|
||||
let connection = manager.get_connection();
|
||||
if connection.get_database_backend() == DbBackend::MySql {
|
||||
// https://github.com/warp-tech/warpgate/issues/857
|
||||
connection
|
||||
.execute_unprepared(
|
||||
"ALTER TABLE `tickets` MODIFY COLUMN `expiry` TIMESTAMP NULL DEFAULT NULL",
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue