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;
26mod m20260818_000001_sandbox_network_slot;
27mod m20260824_000001_mount_owner_config;
28mod m20260829_000001_split_snapshot_identity;
29mod m20260910_000001_snapshot_groups;
30pub mod schema_metadata;
31
32use sea_orm_migration::prelude::*;
33
34//--------------------------------------------------------------------------------------------------
35// Re-Exports
36//--------------------------------------------------------------------------------------------------
37
38pub use sea_orm_migration::MigratorTrait;
39
40//--------------------------------------------------------------------------------------------------
41// Types
42//--------------------------------------------------------------------------------------------------
43
44/// The migrator that runs all migrations in order.
45pub struct Migrator;
46
47//--------------------------------------------------------------------------------------------------
48// Trait Implementations
49//--------------------------------------------------------------------------------------------------
50
51#[async_trait::async_trait]
52impl MigratorTrait for Migrator {
53    fn migrations() -> Vec<Box<dyn MigrationTrait>> {
54        vec![
55            Box::new(m20260305_000001_create_image_tables::Migration),
56            Box::new(m20260305_000002_create_sandbox_tables::Migration),
57            Box::new(m20260305_000003_create_storage_tables::Migration),
58            Box::new(m20260305_000004_create_sandbox_images_table::Migration),
59            Box::new(m20260410_000001_erofs_image_schema::Migration),
60            Box::new(m20260501_000001_create_snapshot_index::Migration),
61            Box::new(m20260517_000001_drop_sandbox_metric::Migration),
62            Box::new(m20260527_000001_migrate_oci_rootfs_source::Migration),
63            Box::new(m20260531_000001_create_sandbox_labels::Migration),
64            Box::new(m20260531_000002_index_sandbox_labels_key_value::Migration),
65            Box::new(m20260606_000001_named_volume_kinds::Migration),
66            Box::new(m20260621_000001_add_sandbox_ephemeral::Migration),
67            Box::new(m20260621_000002_create_maintenance_lease::Migration),
68            Box::new(m20260703_000001_add_sandbox_active_config::Migration),
69            Box::new(m20260708_000001_migrate_bind_rootfs_source::Migration),
70            Box::new(m20260710_000001_migrate_root_disk::Migration),
71            Box::new(m20260714_000001_add_snapshot_scope::Migration),
72            Box::new(m20260723_000001_snapshot_artifact_transition::Migration),
73            Box::new(m20260719_000001_create_cpu_allocations::Migration),
74            Box::new(m20260803_000001_create_writeback_allocations::Migration),
75            Box::new(m20260808_000001_create_memory_allocation_nodes::Migration),
76            Box::new(m20260810_000001_rebuild_sandbox_labels::Migration),
77            Box::new(m20260813_000001_share_cpu_allocations::Migration),
78            Box::new(m20260824_000001_mount_owner_config::Migration),
79            // This backdated migration first shipped in v0.6.16, after the
80            // v0.6.15 mount-owner marker. Keep release order here even though
81            // the identifiers sort differently.
82            Box::new(m20260818_000001_sandbox_network_slot::Migration),
83            // Unreleased snapshot-stack migrations follow the complete released prefix.
84            Box::new(m20260829_000001_split_snapshot_identity::Migration),
85            Box::new(m20260910_000001_snapshot_groups::Migration),
86        ]
87    }
88}