SeaQL / sea-query

🔱 A dynamic SQL query builder for MySQL, Postgres and SQLite
https://www.sea-ql.org
Other
1.12k stars 182 forks source link

`Table::drop()` with multiple `.table` when using sqlite3 causes invalid sql #737

Open uttarayan21 opened 8 months ago

uttarayan21 commented 8 months ago

Description

    let down = Table::drop()
        .table(RootFolderIden::Table)
        .table(FolderIden::Table)
        .table(FileIden::Table)
        .build(SqliteQueryBuilder);

That generates the following sql

DROP TABLE "root_folder", "folder", "file"

Steps to Reproduce

  1. Generate the sql from the above code snippet.

Expected Behavior

Ideally it should be the same as when creating a table. (i.e. overwrites the table name with the last one used )

Actual Behavior

DROP TABLE "root_folder", "folder", "file" Generated a drop table statement with all the tables which isn't supported by sqlite (https://www.sqlite.org/lang_droptable.html)

Reproduces How Often

Always

Versions

│   └── sea-query v0.30.6
│       ├── sea-query-attr v0.1.1 (proc-macro)
│       └── sea-query-derive v0.4.1 (proc-macro)
│   ├── sea-query v0.30.6 (*)
├── sea-query v0.30.6 (*)

Additional Information