Skip to main content

microsandbox_migration/
lib.rs

1//! Database migrations for microsandbox.
2
3mod m20260305_000001_create_image_tables;
4mod m20260305_000002_create_sandbox_tables;
5mod m20260305_000003_create_storage_tables;
6mod m20260305_000004_create_sandbox_images_table;
7mod m20260410_000001_erofs_image_schema;
8mod m20260501_000001_create_snapshot_index;
9mod m20260517_000001_drop_sandbox_metric;
10mod m20260527_000001_migrate_oci_rootfs_source;
11mod m20260531_000001_create_sandbox_labels;
12mod m20260531_000002_index_sandbox_labels_key_value;
13mod m20260606_000001_named_volume_kinds;
14mod m20260621_000001_add_sandbox_ephemeral;
15mod m20260621_000002_create_maintenance_lease;
16mod m20260703_000001_add_sandbox_active_config;
17mod m20260708_000001_migrate_bind_rootfs_source;
18mod m20260710_000001_migrate_root_disk;
19mod m20260714_000001_add_snapshot_scope;
20mod m20260719_000001_create_cpu_allocations;
21mod m20260723_000001_snapshot_artifact_transition;
22mod m20260803_000001_create_writeback_allocations;
23mod m20260808_000001_create_memory_allocation_nodes;
24mod m20260810_000001_rebuild_sandbox_labels;
25mod m20260813_000001_share_cpu_allocations;
26pub mod schema_metadata;
27
28use sea_orm_migration::prelude::*;
29
30//--------------------------------------------------------------------------------------------------
31// Re-Exports
32//--------------------------------------------------------------------------------------------------
33
34pub use sea_orm_migration::MigratorTrait;
35
36//--------------------------------------------------------------------------------------------------
37// Types
38//--------------------------------------------------------------------------------------------------
39
40/// The migrator that runs all migrations in order.
41pub struct Migrator;
42
43//--------------------------------------------------------------------------------------------------
44// Trait Implementations
45//--------------------------------------------------------------------------------------------------
46
47#[async_trait::async_trait]
48impl MigratorTrait for Migrator {
49    fn migrations() -> Vec<Box<dyn MigrationTrait>> {
50        vec![
51            Box::new(m20260305_000001_create_image_tables::Migration),
52            Box::new(m20260305_000002_create_sandbox_tables::Migration),
53            Box::new(m20260305_000003_create_storage_tables::Migration),
54            Box::new(m20260305_000004_create_sandbox_images_table::Migration),
55            Box::new(m20260410_000001_erofs_image_schema::Migration),
56            Box::new(m20260501_000001_create_snapshot_index::Migration),
57            Box::new(m20260517_000001_drop_sandbox_metric::Migration),
58            Box::new(m20260527_000001_migrate_oci_rootfs_source::Migration),
59            Box::new(m20260531_000001_create_sandbox_labels::Migration),
60            Box::new(m20260531_000002_index_sandbox_labels_key_value::Migration),
61            Box::new(m20260606_000001_named_volume_kinds::Migration),
62            Box::new(m20260621_000001_add_sandbox_ephemeral::Migration),
63            Box::new(m20260621_000002_create_maintenance_lease::Migration),
64            Box::new(m20260703_000001_add_sandbox_active_config::Migration),
65            Box::new(m20260708_000001_migrate_bind_rootfs_source::Migration),
66            Box::new(m20260710_000001_migrate_root_disk::Migration),
67            Box::new(m20260714_000001_add_snapshot_scope::Migration),
68            Box::new(m20260723_000001_snapshot_artifact_transition::Migration),
69            Box::new(m20260719_000001_create_cpu_allocations::Migration),
70            Box::new(m20260803_000001_create_writeback_allocations::Migration),
71            Box::new(m20260808_000001_create_memory_allocation_nodes::Migration),
72            Box::new(m20260810_000001_rebuild_sandbox_labels::Migration),
73            Box::new(m20260813_000001_share_cpu_allocations::Migration),
74        ]
75    }
76}