36 lines
1.5 KiB
Rust
36 lines
1.5 KiB
Rust
//! Migration: add telegram_chat_id and telegram_notifications to User
|
|
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub(super) struct Migration;
|
|
impl ::cot::db::migrations::Migration for Migration {
|
|
const APP_NAME: &'static str = "web-petting";
|
|
const MIGRATION_NAME: &'static str = "m_0006_user_telegram";
|
|
const DEPENDENCIES: &'static [::cot::db::migrations::MigrationDependency] =
|
|
&[::cot::db::migrations::MigrationDependency::migration(
|
|
"web-petting",
|
|
"m_0005_testimonials",
|
|
)];
|
|
const OPERATIONS: &'static [::cot::db::migrations::Operation] = &[
|
|
::cot::db::migrations::Operation::add_field()
|
|
.table_name(::cot::db::Identifier::new("web_petting__user"))
|
|
.field(
|
|
::cot::db::migrations::Field::new(
|
|
::cot::db::Identifier::new("telegram_chat_id"),
|
|
<Option<String> as ::cot::db::DatabaseField>::TYPE,
|
|
)
|
|
.set_null(<Option<String> as ::cot::db::DatabaseField>::NULLABLE),
|
|
)
|
|
.build(),
|
|
::cot::db::migrations::Operation::add_field()
|
|
.table_name(::cot::db::Identifier::new("web_petting__user"))
|
|
.field(
|
|
::cot::db::migrations::Field::new(
|
|
::cot::db::Identifier::new("telegram_notifications"),
|
|
<Option<bool> as ::cot::db::DatabaseField>::TYPE,
|
|
)
|
|
.set_null(<Option<bool> as ::cot::db::DatabaseField>::NULLABLE),
|
|
)
|
|
.build(),
|
|
];
|
|
}
|