evento_sql_migrator/m0003/mod.rs
1//! Migration for schema refinements.
2//!
3//! This module removes the snapshot table (no longer used) and extends the event
4//! name column for longer event type names.
5
6mod event;
7
8use sqlx_migrator::vec_box;
9
10/// Migration that drops the snapshot table and extends the event name column.
11///
12/// This migration makes two changes to optimize the schema:
13///
14/// ## Changes
15///
16/// 1. **Drops the snapshot table** - The snapshot functionality has been removed
17/// from Evento, so this table is no longer needed.
18///
19/// 2. **Extends event.name column** - Changes the `name` column from VARCHAR(20)
20/// to VARCHAR(50) to accommodate longer event type names.
21///
22/// ## Database-Specific Notes
23///
24/// - **SQLite**: The column alteration is a no-op since SQLite doesn't support
25/// `ALTER COLUMN`. The column was already created with sufficient length.
26/// - **MySQL**: Uses `MODIFY COLUMN` syntax.
27/// - **PostgreSQL**: Uses standard `ALTER COLUMN` syntax.
28///
29/// ## Dependencies
30///
31/// This migration depends on [`M0002`](crate::M0002).
32pub struct M0003;
33
34#[cfg(feature = "sqlite")]
35sqlx_migrator::sqlite_migration!(
36 M0003,
37 "main",
38 "m0003",
39 vec_box![crate::M0002],
40 vec_box![event::alter_name_column::Operation,]
41);
42
43#[cfg(feature = "mysql")]
44sqlx_migrator::mysql_migration!(
45 M0003,
46 "main",
47 "m0003",
48 vec_box![crate::M0002],
49 vec_box![event::alter_name_column::Operation,]
50);
51
52#[cfg(feature = "postgres")]
53sqlx_migrator::postgres_migration!(
54 M0003,
55 "main",
56 "m0003",
57 vec_box![crate::M0002],
58 vec_box![event::alter_name_column::Operation,]
59);