Sqlite db file help

i have a question here regarding the sqlite db files that have extension of .sqlite.

currently i started to use github to import all my updated files after using atom to commit into github

so basically my dev process is something like this

atom -> github -> glitch.

in this case, Glitch will keep on replacing my .sqlite file which causes my db to reset everytime i import from github to glitch and if i don’t include the .sqlite file on my github, after import, glitch will have everything replace as if there is no .sqlite file before cause was not in github repo. Is there anyway to prevent this?

Could you put your database file in the .data directory?

That directory is in .gitignore, and also doesn’t get copied when someone remixes your project.

Where can i find this .data directory?
i am not able to see them at the directory tree

That’s right - it’s not in the editor directory tree.

Depending on your project you could open up the console and mkdir .data. Or in your code when you create the database just write into the .data directory and it will make the directory for you

let db =  new sqlite3.Database('.data/db.sqlite')
1 Like

thanks, will try. should work

hi funky,
i have tried to mkdir .data and also with the code line. but the file doesnt show up.

i am trying the hello sqlite glitch in which they pre-wrote a db that has a table named choices.
i would like to create a new table name Questions and insert into that.

but to no avail. the app keeps using the choices table which i cannot trace it schema and db file to alter it.
can you please explain how to write new table and how to connect to it into the db?

Hi there - you do not need to create the .data folder, it’s already there. And we hide .data and any other . file/director from the file tree. If you need to see if a file called choice.sqlite exists in it, for example, you can run ls .data in the terminal and it will list what’s inside.

I ran cd .data and ls. There is a db.sqlite but it is empty. Every attempt to create a new schema fails.

Create a new thread here about the issue (this thread is very old and your question deserves its own space) and include the project name if possible, as well as a description of what you’re trying to do and the failure that’s occuring.

2 Likes