Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite Selected DB Path includes current folder #430

Closed
bricakeld opened this issue Oct 27, 2019 · 9 comments
Closed

SQLite Selected DB Path includes current folder #430

bricakeld opened this issue Oct 27, 2019 · 9 comments
Assignees
Labels
sqlite SQLite driver
Milestone

Comments

@bricakeld
Copy link

bricakeld commented Oct 27, 2019

Describe the bug
When I select an sqlite file, the current folder is included in the path, resulting in an error that says the database file cannot be opened. It can be fixed manually by changing the file path in the connections json setting, but by default, I'm guessing the file selector should result in a correct path added to the json.

To Reproduce
Example project dir:

|--Project
  |--src
  |--db
    |--test.sqlite

Steps to reproduce the behavior:

  1. Open SQLTools extension
  2. Click on 'Add New Connection'
  3. Select SQLite (Node Native) in the Connection Assistant
  4. Enter connection name and select file
  5. Save connection
  6. Error can be seen here where the file to the database file is saved in the resulting json as .\\<current_folder>/path/to/db.sqlite or as in example, .\\Project/db/test.sqlite
  7. When testing or opening the connection, an error is thrown saying the file cannot be found

Expected behavior
The correct file path should exclude the current folder, and be saved directly as ./path/to/db.sqlite or as in example, ./db/test.sqlite
Using the full file path of the sqlite file works too.

Desktop (please complete the following information):

  • SQLTools Version v0.21.1
  • VSCode Version: v1.39.2
  • Dialect Used/Version: SQLite
  • OS: Windows 10
@mtxr
Copy link
Owner

mtxr commented Nov 3, 2019

are you using settings.json or vscode workspace files?

@mtxr mtxr added the sqlite SQLite driver label Nov 3, 2019
@triage-new-issues triage-new-issues bot removed the triage label Nov 3, 2019
@mtxr
Copy link
Owner

mtxr commented Nov 3, 2019

I'll make SQLite relative to settings file or workspace file. We've already had a lot of similar issues, that's very opinionated because which user has an understanding about this path. I'll use vscode standard, relative to current setting file dir.

@mtxr mtxr added this to the v0.21 milestone Nov 3, 2019
@gogobook
Copy link

gogobook commented Nov 3, 2019

The same issue in ubuntu, can fix .vscode\settings.json directly.

@bricakeld
Copy link
Author

are you using settings.json or vscode workspace files?

I'm using vs code workspace files but regardless, I'm guessing the file path to be inserted should be relative to the current vs code project directory.

If it's global in settings.json perhaps using the full file path would be better? I've tried pasting the full file path into my workspace json and it is working.

@mtxr mtxr closed this as completed in 4343afa Nov 4, 2019
@mtxr mtxr reopened this Nov 4, 2019
@mtxr
Copy link
Owner

mtxr commented Nov 4, 2019

Closed by mistake

@mtxr mtxr self-assigned this Nov 4, 2019
@mtxr mtxr closed this as completed in 5bfcbd4 Nov 6, 2019
@mtxr
Copy link
Owner

mtxr commented Nov 6, 2019

I've fixed this using vscode guides for workspaces. See: https://code.visualstudio.com/docs/editor/variables-reference#_variables-scoped-per-workspace-folder

Now files will be saved with ${workspaceFolder:<workspace name>} if it's an saved workspace or ${workspaceFolder} if it's just open folder(s).

We can still use dot syntax ., but that will make connections to be relative to the first opened folder.

This solution covers all 3 supported kinds of workspaces by vscode.

@mtxr
Copy link
Owner

mtxr commented Nov 6, 2019

@bricakeld this will be released tonight, so if will still face problems with paths, just edit you connection, select the file and save it again. It will update to new standard.

@bricakeld
Copy link
Author

Thanks for the fix! I'll try it out next couple days and update again if needed

@mtxr
Copy link
Owner

mtxr commented Nov 6, 2019

🤘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sqlite SQLite driver
Projects
None yet
Development

No branches or pull requests

3 participants