jchristn / SqliteHelper

Simple wrapper for Sqlite databases written in C#.
MIT License
27 stars 14 forks source link

Add Foreign Key & ON DELETE&UPDATE CASCADE #4

Open hhu-mahmoud opened 4 years ago

hhu-mahmoud commented 4 years ago

I want to use the mehtod "CreateTable" but i couldn't set the Foreign Key to the Column.

It would be nice, if the the method can do as example:

CREATE TABLE table_name
(
  column1 datatype [ NULL | NOT NULL ],
  column2 datatype [ NULL | NOT NULL ],
  ...

  CONSTRAINT fk_column
    FOREIGN KEY (column1, column2, ... column_n)
    REFERENCES parent_table (column1, column2, ... column_n)
    ON DELETE CASCADE
);
jchristn commented 4 years ago

Hi @hhu-mahmoud I explicitly wanted to avoid this level of configurability/abstraction because of the complexity it would introduce. Further I'm merging this project into the DatabaseWrapper project and I'd have to do something consistent across Sqlite as well as SQL Server, MySQL, Postgres, etc.

Will keep this open as an enhancement. If you'd like to submit a PR please feel free. Otherwise I'll keep it and get to it as I can. Thanks!

hhu-mahmoud commented 4 years ago

@jchristn yes it can be opend as enhancement. i will see, if i find time later, then i will sumbit PR. Thank you