risingwave_meta_model_migration/
m20241016_065621_hummock_gc_history.rs1use sea_orm_migration::prelude::*;
2
3#[derive(DeriveMigrationName)]
4pub struct Migration;
5
6#[async_trait::async_trait]
7impl MigrationTrait for Migration {
8 async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
9 manager
10 .create_table(
11 Table::create()
12 .table(HummockGcHistory::Table)
13 .if_not_exists()
14 .col(
15 ColumnDef::new(HummockGcHistory::ObjectId)
16 .big_integer()
17 .not_null()
18 .primary_key(),
19 )
20 .col(
21 ColumnDef::new(HummockGcHistory::MarkDeleteAt)
22 .date_time()
23 .not_null(),
24 )
25 .to_owned(),
26 )
27 .await?;
28 manager
29 .create_index(
30 Index::create()
31 .table(HummockGcHistory::Table)
32 .name("idx_hummock_gc_history_mark_delete_at")
33 .col(HummockGcHistory::MarkDeleteAt)
34 .to_owned(),
35 )
36 .await?;
37 Ok(())
38 }
39
40 async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
41 crate::drop_tables!(manager, HummockGcHistory);
42 Ok(())
43 }
44}
45
46#[derive(DeriveIden)]
47enum HummockGcHistory {
48 Table,
49 ObjectId,
50 MarkDeleteAt,
51}