Skip to content

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

@wojexe

Description

@wojexe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions