made the columns in the orders table to DateTime so that way it will be easy to get previous order. sorry for changing the sql file so many times