Skip to content

Releases: vapor/sql-kit

Support the LIKE and NOT LIKE operators.

07 Feb 01:05
66c9ed2
Compare
Choose a tag to compare

The .like. and .notLike binary operators now work.

Enum Support

22 Jan 02:44
371bdf2
Compare
Choose a tag to compare
Enum Support Pre-release
Pre-release

Adds support for using SQL enums natively. There are three different levels of support:

  • typeName: Postgres-like, has CREATE TYPE ... AS ENUM syntax
  • inline: MySQL-like, has ENUM(...) data type
  • unsupported: SQLite-like, no enum support.

Supported enum syntax is available via SQLDialect.enumSyntax. This can be used to conditionally run code depending on database support.

A new test case SQLBenchmarker.testEnum has been added that tests the following on all three databases:

  • Create table with enum column
  • Add new value to enum
  • Drop value from enum

Note: Dropping enum values from Postgres-like DBs is not supported.

Here is the raw SQL output from the benchmark for each database:

SQLite

CREATE TABLE "planets"("id" BIGINT PRIMARY KEY, "name" TEXT NOT NULL, "type" TEXT NOT NULL) []
INSERT INTO "planets" ("name", "type") VALUES (?, 'smallRocky'), (?, 'gasGiant') ["Earth", "Jupiter"]
INSERT INTO "planets" ("name", "type") VALUES (?, 'dwarf') ["Pluto"]
DELETE FROM "planets" WHERE "type" = 'gasGiant' []
DROP TABLE "planets" []

Postgres

CREATE TYPE "planet_type" AS ENUM ('smallRocky', 'gasGiant') []
CREATE TABLE "planets"("id" BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "name" TEXT NOT NULL, "type" "planet_type" NOT NULL) []
INSERT INTO "planets" ("name", "type") VALUES ($1, 'smallRocky'), ($2, 'gasGiant') ["Earth", "Jupiter"]
ALTER TYPE "planet_type" ADD VALUE 'dwarf' []
INSERT INTO "planets" ("name", "type") VALUES ($1, 'dwarf') ["Pluto"]
DELETE FROM "planets" WHERE "type" = 'gasGiant' []
DROP TABLE "planets" []
DROP TYPE "planet_type" []

MySQL

Opening new connection to [IPv6]localhost/::1:3306
CREATE TABLE `planets`(`id` BIGINT PRIMARY KEY AUTO_INCREMENT, `name` TEXT NOT NULL, `type` ENUM('smallRocky', 'gasGiant') NOT NULL) []
INSERT INTO `planets` (`name`, `type`) VALUES (?, 'smallRocky'), (?, 'gasGiant') ["Earth", "Jupiter"]
ALTER TABLE `planets` MODIFY `type` ENUM('smallRocky', 'gasGiant', 'dwarf') []
INSERT INTO `planets` (`name`, `type`) VALUES (?, 'dwarf') ["Pluto"]
DELETE FROM `planets` WHERE `type` = 'gasGiant' []
ALTER TABLE `planets` MODIFY `type` ENUM('smallRocky', 'dwarf') []
DROP TABLE `planets` []

Moved #83 here.

SQLKit 3.0.0 Beta 3

13 Dec 22:03
d09b552
Compare
Choose a tag to compare
SQLKit 3.0.0 Beta 3 Pre-release
Pre-release
  • Added new SQLRow.decode(model:) method (#79)
  • SQLRow protocol expanded to support Codable (#79)
  • Added first(decoding:) all(decoding:) and run(decoding:) methods to SQLQueryFetcher (#79)
  • Added set(model:) method to SQLUpdateBuilder (#79)

SQLKit 3.0.0 Beta 2

09 Dec 17:21
f0e0029
Compare
Choose a tag to compare
SQLKit 3.0.0 Beta 2 Pre-release
Pre-release
  • Adds support for passing custom Loggers (#73)
  • Adds general purpose table constraints (#62)
  • Changes to using SQL 92 standard not equal operator (#61)
  • SQLDialect protocol has been reworked to be non-mutating. SQLDatabase now carries a reference to its dialect. (#70)
  • Enabled test discovery on Linux (#78)

SQLKit 3.0.0 Beta 1

24 Oct 20:41
2a05245
Compare
Choose a tag to compare
SQLKit 3.0.0 Beta 1 Pre-release
Pre-release
  • SQLDialect can now suppress IF [NOT] EXISTS using the supportsIfExists option. (#68)
  • GROUP BY and HAVING are now supported. (#69)

SQLKit 3.0.0 Alpha 1.4

10 Oct 17:27
Compare
Choose a tag to compare
Pre-release
  • Fixed a SQL syntax error in SELECT statements with multiple joins

SQLKit 3.0.0 Alpha 1.3

14 Aug 17:53
Compare
Choose a tag to compare
Pre-release

New:

  • Added SQLDialect.literalDefault option for customizing default literal string

SQLKit 3.0.0 Alpha 1.2

09 Jul 15:56
Compare
Choose a tag to compare
Pre-release

New:

  • Adds SQLInsertBuilder.model method.
  • Adds SQLQueryEncoder.

SQLKit 3.0.0 Alpha 1.1

06 Jun 00:07
1bde239
Compare
Choose a tag to compare
Pre-release

New:

  • Added SQLDataType.custom(SQLExpression)

SQLKit 3.0.0 Alpha 1

04 Jun 01:08
c33b5f0
Compare
Choose a tag to compare