Fix column declarations and references so that foreign keys and references work.