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 driver should support dropping columns in ALTER TABLE statements #91

Closed
wojexe opened this issue May 15, 2024 · 0 comments · Fixed by #92
Closed

SQLite driver should support dropping columns in ALTER TABLE statements #91

wojexe opened this issue May 15, 2024 · 0 comments · Fixed by #92
Labels
bug Something isn't working

Comments

@wojexe
Copy link

wojexe commented May 15, 2024

Describe the issue

SQLite driver should support dropping columns in ALTER TABLE statements

Vapor version

4.97.0

Operating system and version

macOS Sonoma 14.4.1

Swift version

Swift Package Manager - Swift 5.10.0-dev

Steps to reproduce

let database: Database // = req.db

try await database.schema(Tree.schema)
    .deleteField("created_at")
    .update()

Outcome

This code will currently fail with SQLite Database with this error:

[ WARNING ] SQLite only supports adding columns in ALTER TABLE statements.
Swift/ErrorType.swift:200: Fatal error: Error raised at top level: SQLite only supports adding columns in ALTER TABLE statements.

Additional notes

The error is thrown, because it falls into this guard statement:
https://github.com/vapor/fluent-sqlite-driver/blame/be7051a9cfcd4e3aeb10d7303cb2634d034350b8/Sources/FluentSQLiteDriver/FluentSQLiteDatabase.swift#L52

Support for dropping columns was added in SQLite 3.35.0

@wojexe wojexe added the bug Something isn't working label May 15, 2024
gwynne added a commit that referenced this issue May 15, 2024
…atabaseSchema.deleteField(_:)) with SQLite; it has been supported since SQLite 3.35.0. Fixes #91.
gwynne added a commit that referenced this issue May 16, 2024
* Remove the artificial restriction on using ALTER TABLE DROP COLUMN (DatabaseSchema.deleteField(_:)) with SQLite; it has been supported since SQLite 3.35.0. Fixes #91.

* Can't link to stuff that's not in the same module. Fixes a DocC warning.

* Update SQLiteKit and FluentKit dependency requirements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant