I am trying to write a table from R to mySQL using dbWriteTable. I would also like to specify that the certain fieldtypes cannot be null and a default value for those specific fieldtypes.
I am currently using the below code to specify the field type but not sure how to specify a default and mark certain fields as cannot be null.
I am trying to preserve the structure of the table as I read it in R. While writing back to sql some elements of the structure are lost.
dbWriteTable(conn = connection,
name = "barcode_details",
value = barcode_details_update,
field.types = c(
id = "float",
order_no = "varchar(50)"))