Skip to content

add_column() should support REFERENCES {other_table}({other_column}) #16

Closed

Description

@simonw

Related to #2

Activity

  1. modified the milestone: 1.0 on May 25, 2019
  2. simonw commented on May 29, 2019

    @simonw
    OwnerAuthor

    For the CLI I'm thinking:

    sqlite-utils add-column data.db mytable col text --fk othertable id
    

    So the foreign key is added using --fk othertable othercolumn

    If the user doesn't provide the column type we can derive it from the foreign key.

    Can we make the othercolumn optional? That would be neat - then we could automatically detect it using the sole primary key of the referenced table.

  3. simonw commented on May 29, 2019

    @simonw
    OwnerAuthor

    Hmm... probably not:

    For options, only a fixed number of arguments is supported.

  4. simonw commented on May 29, 2019

    @simonw
    OwnerAuthor

    In that case --fk othertable detects the primary key.

    If you want to point at a different column, use --fk-col X

  5. simonw commented on May 29, 2019

    @simonw
    OwnerAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions