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-utils create-table ... --if-not-exists #400

Closed
simonw opened this issue Feb 6, 2022 · 1 comment
Closed

sqlite-utils create-table ... --if-not-exists #400

simonw opened this issue Feb 6, 2022 · 1 comment
Labels
cli-tool enhancement New feature or request wontfix This will not be worked on

Comments

@simonw
Copy link
Owner

simonw commented Feb 6, 2022

Inspired by:

To match the option on create-index: https://sqlite-utils.datasette.io/en/stable/cli-reference.html#create-index

  --if-not-exists        Ignore if index already exists
@simonw simonw added enhancement New feature or request cli-tool labels Feb 6, 2022
@simonw simonw changed the title sqlite-utils create-table --if-not-exists sqlite-utils create-table ... --if-not-exists Feb 6, 2022
@simonw
Copy link
Owner Author

simonw commented Feb 6, 2022

Actually this is not needed - there is already an option that does this, it's just called --ignore rather than --if-not-exists.

The lack of consistency here is a little annoying, but not annoying enough to justify making a backwards incompatible change.

% sqlite-utils create-table --help
Usage: sqlite-utils create-table [OPTIONS] PATH TABLE COLUMNS...

  Add a table with the specified columns. Columns should be specified using
  name, type pairs, for example:

      sqlite-utils create-table my.db people \
          id integer \
          name text \
          height float \
          photo blob --pk id

Options:
  --pk TEXT                 Column to use as primary key
  --not-null TEXT           Columns that should be created as NOT NULL
  --default <TEXT TEXT>...  Default value that should be set for a column
  --fk <TEXT TEXT TEXT>...  Column, other table, other column to set as a
                            foreign key
  --ignore                  If table already exists, do nothing
  --replace                 If table already exists, replace it
  --load-extension TEXT     SQLite extensions to load
  -h, --help                Show this message and exit.

@simonw simonw closed this as completed Feb 6, 2022
@simonw simonw added the wontfix This will not be worked on label Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli-tool enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant