-
I want to create a new table, so I threw together a Model. Now what do I do? I can't find any examples of how to create the database table from this nor where to put the code. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
The (very helpful) Axum example has this:
But that seem like I'm repeating myself if I already have the model definition. |
Beta Was this translation helpful? Give feedback.
-
The only way around it to move forward quickly that I see is to create the table in Postgres manually and then derive the the model from there using |
Beta Was this translation helpful? Give feedback.
-
I could piece this together: let backend = conn.get_database_backend();
let schema = Schema::new(backend);
let table_create_statement = schema.create_table_from_entity(FoursquareGmapsMappings);
let table_create_result = conn.execute(backend.build(&table_create_statement)).await;
println!("Table create result: {:?}", table_create_result.unwrap()); |
Beta Was this translation helpful? Give feedback.
I could piece this together: