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

Modernize SQLite feature support #100

Merged
merged 6 commits into from
Nov 12, 2022
Merged

Modernize SQLite feature support #100

merged 6 commits into from
Nov 12, 2022

Conversation

gwynne
Copy link
Member

@gwynne gwynne commented Nov 11, 2022

The following changes have been made:

  • SQLiteDatabase now vends the version of SQLite in use per the SQLDatabaseReportedVersion protocol.
  • UPSERT syntax is now available for SQLite when the runtime library version is new enough (3.24.0 or newer)
  • RETURNING syntax is now available for SQLite when the runtime library version is new enough (3.35.0 or newer)
  • When emitting placeholders for bound parameters, the numbered ?NNN syntax is now used instead of plain ? placeholders.
  • Requests to create columns of type .bigint (via SQLCreateTable or Fluent's SchemaBuilder) now map explicitly to the INTEGER type name, which has the same data size but will correctly enable auto-increment behavior if the column is a table's primary key (previously this only worked when specifying SQLDataType.int or Fluent equivalent).
  • Dropped support for Swift up to and including 5.4, 5.5 is now the minimum.
  • CI was heavily updated, with the same changes as were made to SQLiteNIO.

These changes depend on vapor/sqlite-nio#34.

…onfusing whitespace and simplifying most of the content. Adds a `customDataType(for:)` override to handling requests for bigint types and switches from plain `?` for placeholders to SQLite's numbered `?NNNN` representation per SQLite docs recommendation.
…SQLiteDatabase, and use it to enable version-dependent RETURNING and UPSERT support for SQLite.
@gwynne gwynne force-pushed the upsert-and-other-support branch from d71e876 to 53db258 Compare November 11, 2022 23:21
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@55ed1fc). Click here to learn what that means.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #100   +/-   ##
=======================================
  Coverage        ?   65.76%           
=======================================
  Files           ?        7           
  Lines           ?      295           
  Branches        ?        0           
=======================================
  Hits            ?      194           
  Misses          ?      101           
  Partials        ?        0           
Flag Coverage Δ
unittests 65.76% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

@gwynne gwynne merged commit c07d530 into main Nov 12, 2022
@gwynne gwynne deleted the upsert-and-other-support branch November 12, 2022 12:06
@VaporBot
Copy link

These changes are now available in 4.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver-minor Contains new APIs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants