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