Elite Dangerous: Insurance
If you do not have enough money to rebuy your old ship you will be provided a loan. Maximum amount of loan is 200 000 credits, so keep that in mind.
From 1.3 loan amount will be tied to ship so more expensive ship owners can borrow bigger amounts and be able to pay for destroyed ship.