Releases: vapor/sql-kit
Releases · vapor/sql-kit
Support the LIKE and NOT LIKE operators.
The .like
. and .notLike
binary operators now work.
Enum Support
Adds support for using SQL enums natively. There are three different levels of support:
typeName
: Postgres-like, hasCREATE TYPE ... AS ENUM
syntaxinline
: MySQL-like, hasENUM(...)
data typeunsupported
: 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
SQLKit 3.0.0 Beta 2
- Adds support for passing custom
Logger
s (#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
SQLKit 3.0.0 Alpha 1.4
- Fixed a SQL syntax error in
SELECT
statements with multiple joins
SQLKit 3.0.0 Alpha 1.3
New:
- Added
SQLDialect.literalDefault
option for customizing default literal string
SQLKit 3.0.0 Alpha 1.2
New:
- Adds
SQLInsertBuilder.model
method. - Adds
SQLQueryEncoder
.
SQLKit 3.0.0 Alpha 1.1
New:
- Added
SQLDataType.custom(SQLExpression)
SQLKit 3.0.0 Alpha 1
More information on Vapor 4 alpha releases:
https://medium.com/@codevapor/vapor-4-alpha-1-releases-begin-94a4bc79dd9a
API Docs: