dolthub / dolthub/dolt

Prevent nesting database directories on disk

Open
#5,914 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 8h
Merged PRs (30d)
120

Description

Currently we can end up in situations fairly easily where out data directories are nested. For example:

```
$ mkdir foo; cd $_
$ dolt init
Successfully initialized dolt data repository.
$ dolt sql-server
Starting server with Config HP="localhost:3306"|T="28800000"|R="false"|L="info"|S="/tmp/mysql.sock"
```

Different shell:
```
dolt sql-client -u root
# Welcome to the Dolt MySQL client.
# Statements must be terminated with ';'.
# "exit" or "quit" (or Ctrl-D) to exit.
mysql> create database innerdb;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| foo |
| information_schema |
| innerdb |
| mysql |
+--------------------+
4 rows in set (0.00 sec)
```

Now you have a directory with the following:
```
foo
├── .dolt
[snip]
└── innerdb
└── .dolt
```

This leads to confusion for new users (and old farts like me). A couple options to consider:
1) Change the behavior of `dolt init` to require a database name. You could do the following:
```
$ dolt init db1
$ dolt init db2
$ dolt sql-server
```
And db1 and db2 would both be accessible.

2) Allow `dolt sql-server` to start in "single database mode", which would prevent you from running `create database`

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the nested-directory scenario using `dolt init`, `dolt sql-server`, `dolt sql-client`, and `create database`. Read the command paths for `dolt init` and `dolt sql-server`, then clarify which proposed behavior is intended before changing anything. Done means the chosen behavior prevents or clearly handles nested database directories, with coverage for the demonstrated workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, mysql, sql
Domain
cli, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.