risingwave_meta_model_migration/
m20250522_074525_iceberg_tables.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(IcebergTables::Table)
13 .if_not_exists()
14 .col(
15 ColumnDef::new(IcebergTables::CatalogName)
16 .string_len(255)
17 .not_null(),
18 )
19 .col(
20 ColumnDef::new(IcebergTables::TableNamespace)
21 .string_len(255)
22 .not_null(),
23 )
24 .col(
25 ColumnDef::new(IcebergTables::TableName)
26 .string_len(255)
27 .not_null(),
28 )
29 .col(
30 ColumnDef::new(IcebergTables::MetadataLocation)
31 .string_len(1000)
32 .null(),
33 )
34 .col(
35 ColumnDef::new(IcebergTables::PreviousMetadataLocation)
36 .string_len(1000)
37 .null(),
38 )
39 .primary_key(
40 Index::create()
41 .col(IcebergTables::CatalogName)
42 .col(IcebergTables::TableNamespace)
43 .col(IcebergTables::TableName),
44 )
45 .to_owned(),
46 )
47 .await
48 }
49
50 async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
51 manager
52 .drop_table(Table::drop().table(IcebergTables::Table).to_owned())
53 .await
54 }
55}
56
57#[derive(DeriveIden)]
58enum IcebergTables {
59 Table,
60 CatalogName,
61 TableNamespace,
62 TableName,
63 MetadataLocation,
64 PreviousMetadataLocation,
65}