The right? You did, when you consented to the installation of new software or doing automatic updates.
iTunes 12.2 "lost " library issue - https://discussions.apple.com/thread/7113917?answerId=28513415022#28513415022 - seems to work for some
First determine if the media files are still present in the iTunes > Media folder. If they are not you will have to restore them from the backup you of course made of your computer before installing new software. If they are still there then try one of the following methods to rebuild the database which tells iTunes what media you have in your collection and where it is.
ASC user turingtest2 help document: Empty/corrupt iTunes library after upgrade/crash - https://discussions.apple.com/docs/DOC-6561
Here are the two main methods. Method 1 does revert your library list (but not media files) to the state it was at the time indicated on the file but all metadata are preserved. Method 2 may permit using a more recent version (.xml) of your iTunes library than a previous .itl version but you have to be willing to accept loss of some metadata.
1) iTunes: How to re-create your iTunes library and playlists - https://support.apple.com/en-us/HT201561 - These instructions have you open iTunes with an old iTunes library file archived at the time you last updated iTunes. This will revert your library content list and appearance to what it was at the date indicated on the file. Newer media not in this list will still be in your media folder. You can re-add these by dragging your media folders to the Automatically Add To iTunes folder but they will regarded as brand new items.
A method 1 shortcut that seems to work with more recent iTunes versions - https://discussions.apple.com/thread/7105888?answerId=28484935022#28484935022 - However, I have not tried this and would want to make sure it didn't start creating additional files and folders inside the "previous libraries" folder that doing things the official way would avoid.
2) If you don't see your content after updating iTunes - https://support.apple.com/en-us/HT203225 - These instructions use a trimmed-down version of your library file to rebuild your primary library file. You lose some metadata (ratings, play count, date added) but the listing should be fairly up to date.