I want to import an existing SQLite database. However, when I try to drag it into Glitch, it just gets uploaded to the assets. And when I try to use the template from my GitHub repo, suddenly the tables no longer exist, despite it being fine when I download the file locally. Any way to import an existing SQLite file?
Hey there,
I tried to reproduce this issue, however, I was not able to.
You can perhaps upload the file from assets folder into a different folder and access it from there:
- Go to the assets folder in your project and select the image you want to upload locally to your Glitch project. Click on the ‘Copy URL’ button. This will copy an image URL like
https://cdn.glitch.com/f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521
to your clipboard. How to access ‘Assets’ drawer - Go to the ‘Console’ in Glitch, and if you don’t already have an assets folder, type
mkdir assets
and hit enter. (How to access Console on Glitch editor - type
cd assets
and hit enter to move into the assets folder. - type
wget
and then paste the image URL, you copied previously into the console, so you see something likewget https://cdn.glitch.com/f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521
and hit enter. That’ll import that image to your assets folder. Note that it’ll be imported with the namef6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521
. To make it easier to deal with you’ll want to rename it. To do so, typemv /app/assets/f6254aa9-8051-48db-bbc1-5e7766f748c5%2Fw6.jpg?1531238960521 /app/assets/w6.jpg
and hit enter. You can confirm the asset renamed correctly by typingls -al
and you’ll see a list of files, one of which should be calledw6.jpg
. - Repeat steps 1 and 4 for each image you want to upload. Be sure to change the name of the file to the relevant one in step 4.
The path you’ll then use is: __dirname + '/assets/w6.jpg'
The assets folder is not a folder it is apart of the CDN.
This is still happening exactly as you describe. How do you import an existing SQLite database into Glitch?
You wget
it into your container using your project’s terminal (button at the bottom in the editor) from somewhere that you’ve already (temporarily) made web-accessible. And then you make sure to keep it small enough so your project doesn’t get suspended for taking up too much space =D
Thank you.
Can this be scripted?
Probably, but that’s up to you: you’re responsible for making sure whatever code you host behaves itself.