According to this on the penultimate Q/A provided you're using the same PSN account it should be safe to buy it on the PS3 if you still have one.
http://m.officialplaystationmagazin...uty-ghosts-faq-details-its-ps3-to-ps4-upgrade
http://m.officialplaystationmagazin...uty-ghosts-faq-details-its-ps3-to-ps4-upgrade