-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_test.rs
More file actions
30 lines (23 loc) · 1.04 KB
/
debug_test.rs
File metadata and controls
30 lines (23 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use mysql2postgres::MySQLToPostgreSQLConverter;
use std::fs;
use tempfile::TempDir;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mysql_dump = "CREATE TABLE `test_table` (`id` INT AUTO_INCREMENT, `name` VARCHAR(255), PRIMARY KEY (`id`));";
let temp_dir = TempDir::new()?;
let input_file = temp_dir.path().join("test_input.sql");
let output_file = temp_dir.path().join("test_output.sql");
fs::write(&input_file, mysql_dump)?;
let converter = MySQLToPostgreSQLConverter::new(&input_file, &output_file, 8192)?;
let stats = converter.convert()?;
let output = fs::read_to_string(&output_file)?;
println!("=== INPUT ===");
println!("{}", mysql_dump);
println!("\n=== OUTPUT ===");
println!("{}", output);
println!("\n=== STATS ===");
println!("{:?}", stats);
println!("\nContains SERIAL: {}", output.contains("SERIAL"));
println!("Contains INT: {}", output.contains("INT"));
println!("Contains AUTO_INCREMENT: {}", output.contains("AUTO_INCREMENT"));
Ok(())
}