mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
create-table now supports multiple --pk, refs #620
This commit is contained in:
parent
1dc5da3e5d
commit
23be5be1dc
3 changed files with 13 additions and 3 deletions
|
|
@ -1489,7 +1489,7 @@ def create_database(path, enable_wal, init_spatialite, load_extension):
|
|||
)
|
||||
@click.argument("table")
|
||||
@click.argument("columns", nargs=-1, required=True)
|
||||
@click.option("--pk", help="Column to use as primary key")
|
||||
@click.option("pks", "--pk", help="Column to use as primary key", multiple=True)
|
||||
@click.option(
|
||||
"--not-null",
|
||||
multiple=True,
|
||||
|
|
@ -1532,7 +1532,7 @@ def create_table(
|
|||
path,
|
||||
table,
|
||||
columns,
|
||||
pk,
|
||||
pks,
|
||||
not_null,
|
||||
default,
|
||||
fk,
|
||||
|
|
@ -1581,7 +1581,7 @@ def create_table(
|
|||
)
|
||||
db[table].create(
|
||||
coltypes,
|
||||
pk=pk,
|
||||
pk=pks[0] if len(pks) == 1 else pks,
|
||||
not_null=not_null,
|
||||
defaults=dict(default),
|
||||
foreign_keys=fk,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue