Initialize the metadata table
(conn: &Connection)
| 21 | impl TypeMetadata { |
| 22 | /// Initialize the metadata table |
| 23 | pub fn init(conn: &Connection) -> Result<()> { |
| 24 | conn.execute( |
| 25 | "CREATE TABLE IF NOT EXISTS __pgsqlite_schema ( |
| 26 | table_name TEXT NOT NULL, |
| 27 | column_name TEXT NOT NULL, |
| 28 | pg_type TEXT NOT NULL, |
| 29 | sqlite_type TEXT NOT NULL, |
| 30 | PRIMARY KEY (table_name, column_name) |
| 31 | )", |
| 32 | [], |
| 33 | )?; |
| 34 | |
| 35 | // Initialize ENUM metadata tables |
| 36 | EnumMetadata::init(conn)?; |
| 37 | |
| 38 | // Initialize ENUM usage tracking table |
| 39 | EnumTriggers::init_enum_usage_table(conn).ok(); |
| 40 | |
| 41 | Ok(()) |
| 42 | } |
| 43 | |
| 44 | /// Store type mappings for a table |
| 45 | pub fn store_type_mappings( |