mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 09:54:31 +02:00
'sqlite-utils add-column name type' command, closes #15
This commit is contained in:
parent
05a85b358f
commit
0bc49e938e
5 changed files with 80 additions and 8 deletions
|
|
@ -134,6 +134,26 @@ def optimize(path, no_vacuum):
|
|||
db.vacuum()
|
||||
|
||||
|
||||
@cli.command(name="add-column")
|
||||
@click.argument(
|
||||
"path",
|
||||
type=click.Path(exists=True, file_okay=True, dir_okay=False, allow_dash=False),
|
||||
required=True,
|
||||
)
|
||||
@click.argument("table")
|
||||
@click.argument("col_name")
|
||||
@click.argument(
|
||||
"col_type",
|
||||
type=click.Choice(
|
||||
["integer", "float", "blob", "text", "INTEGER", "FLOAT", "BLOB", "TEXT"]
|
||||
),
|
||||
)
|
||||
def add_column(path, table, col_name, col_type):
|
||||
"Add a column to the specified table"
|
||||
db = sqlite_utils.Database(path)
|
||||
db[table].add_column(col_name, col_type)
|
||||
|
||||
|
||||
@cli.command(name="create-index")
|
||||
@click.argument(
|
||||
"path",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue