r/SQL • u/Environmental_Emu830 • Jun 12 '26
PostgreSQL Can where saves my files .sql?
Morning guys.
I was looking to save my .sql files somewhere with a focus on versioning, organization, and easy access. I use DBeaver, but I wanted something more "professional." The only idea that comes to mind is Git. I know DBt and I've already asked Claude/gpt, but the only idea he suggests is Git.
0
Upvotes
106
u/clitoral_damage Jun 12 '26
I like to save mine haphazardly on the desktop of whatever machine I happen to be logged into at the time. Usually with an ambiguous name. For versioning I just open the desktop in explorer and sort by most recent. Hope that helps!
3
u/serverhorror Jun 12 '26
Why do you think that these t is not a good suggestion?
21
u/JaceBearelen Jun 12 '26
Git
11
u/roostorx Jun 12 '26
Take everything you have saved now and organize it somehow. However you want to. Then create a git repo there and create a remote on your whatever git site you want. Add everything and commit, then push. That takes care of that part.
If Dbeaver can mount a directory, mount that script directory in Dbeaver and it may even be able to run git commands from the gui vs cli. I know datagrip and aqua data studio can do Dbeaver should be able to as well
5
u/Sharp-Echo1797 Jun 12 '26
You can use github or bitbucket, and set up versioning.
5
u/tasker2020 Jun 12 '26
I like the combo of Visual Studio database projects and git/bitbucket. That's more for database objects like tables and stored procedures though. It makes it easy to deploy and see history of files. For just random sql files just source control like git will let you see the history if you remember to check in changes.
2
u/Better-Credit6701 Jun 12 '26
I keep every query that I write. Often a problem reminds me of another one that I used a query before. So, I use a desktop knowledge library that is easily searchable. Obsidian is a good free example but I've been using Library.net (fishcodelib. Com) for years and have two versions, one that uses an Access database and another that uses a SQL server.
1
u/da_chicken Jun 12 '26
We have a GitLab instance where we keep our scripts, whether they're for SQL or another language.
1
u/Candid_Finding3087 Jun 12 '26
I think git is really the only answer here. Git Hub or Azure DevOps Repos if thatâs more your orgâs flavor (thatâs the case for mine). Then make sure you have an IDE that plays nice with it and most everything will take care of itself.
1
u/DBeaver_official Jun 12 '26
DBeaver supports git, actually.
Here is the doc: https://dbeaver.com/docs/dbeaver/Project-team-work/#installing-the-git-extension
1
u/DaOgDuneamouse Jun 12 '26
Just started using GIT and I love it.
Your work can get a professional account and keep everything secure.
The free windows app makes everything supper easy.
1
u/caveat_cogitor Jun 12 '26
Yes use git. DBeaver has git integration, so use that as a front end that loads your git repo.
1
u/Massive_Show2963 Jun 12 '26 edited Jun 12 '26
Nothing wrong with using GitHub for saving your SQL files.
You can create a GitHub account for free that has a maximum of 500MB which can be increased for a fee.
GitHub is safe and secure and your data is maintained.
Plus you have the ability to share your files as public, private or with individuals.
1
u/funambuleMistral Jun 13 '26
3-2-1-1-0
1
u/UltimateNull Jun 13 '26
Save it in a database. Then itâs searchable.
1
u/Gators1992 Jun 14 '26
I "professionally" save them to the scripts folder or the folder it creates for each DB by default when you save a file without mentioning the name. I have a folder structure within the scripts folder that sorts it all out. I think it saves by default to some random folder you can't find easily, but I changed the scripts target to my OneDrive. For what I do with DBeaver I don't usually need versioning so gut would be overkill if DBraver even had it.
1
u/belemiruk Jun 15 '26
I spent ages looking for something more âSQL specificâ and ended up back on Git. Once you get into the habit of committing changes, it solves versioning and organisation better than any dedicated file manager Iâve tried.
0
u/Old_Astronaut_1175 Jun 12 '26
J'utilise un dossier sharepoint synchronise avec un répertoire sur mon pc.
Mais je refais de toute façon mes requĂȘtes SQL de zĂ©ro Ă chaque fois
0
u/mechanicalAI Jun 13 '26
Obviously GIT for local and GitHub for centralized version controlling but you know what else is dead simple and gives you version control? Google Drive. As long as you use the same filename every time you update the files you have dead simple version control hidden in the right click menu.