Solomon built the terrace as soon as Pharaoh's daughter moved up from the city of David to the palace Solomon built for her.
So David lived in the fortress and called it the City of David. David built all around it, from the terrace inwards.
The palace where he lived was constructed in a similar way. He also constructed a palace like this hall for Pharaoh's daughter, whom he had married.
This is what prompted him to rebel against the king: Solomon built a terrace and he closed up a gap in the wall of the city of his father David.
Hezekiah energetically rebuilt every broken wall. He erected towers and an outer wall, and fortified the terrace of the City of David. He made many weapons and shields.
Solomon made an alliance by marriage with Pharaoh, king of Egypt; he married Pharaoh's daughter. He brought her to the City of David until he could finish building his residence and the temple of the Lord and the wall around Jerusalem.
Here are the details concerning the work crews King Solomon conscripted to build the Lord's temple, his palace, the terrace, the wall of Jerusalem, and the cities of Hazor, Megiddo, and Gezer.
Solomon moved Pharaoh's daughter up from the City of David to the palace he had built for her, for he said, "My wife must not live in the palace of King David of Israel, for the places where the ark of the Lord has entered are holy."