Creating SQL code for inventory history table setup