mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 17:34:32 +02:00
sqlite-utils create-database command, closes #348
This commit is contained in:
parent
f08fe6fd4d
commit
1d64cd2e5b
3 changed files with 48 additions and 0 deletions
|
|
@ -1052,6 +1052,23 @@ def upsert(
|
|||
raise click.ClickException(UNICODE_ERROR.format(ex))
|
||||
|
||||
|
||||
@cli.command(name="create-database")
|
||||
@click.argument(
|
||||
"path",
|
||||
type=click.Path(file_okay=True, dir_okay=False, allow_dash=False),
|
||||
required=True,
|
||||
)
|
||||
@click.option(
|
||||
"--enable-wal", is_flag=True, help="Enable WAL mode on the created database"
|
||||
)
|
||||
def create_table(path, enable_wal):
|
||||
"Create a new empty database file."
|
||||
db = sqlite_utils.Database(path)
|
||||
if enable_wal:
|
||||
db.enable_wal()
|
||||
db.vacuum()
|
||||
|
||||
|
||||
@cli.command(name="create-table")
|
||||
@click.argument(
|
||||
"path",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue