Skip to content

Commit 222dcf7

Browse files
authored
Added create/drop trigger dialect conditions (vapor#169)
* Added create/drop trigger dialect conditions * Uses new trigger dialect syntax * Fixes casing on an option name * Style changes requested by Tanner
1 parent 1990fbf commit 222dcf7

File tree

2 files changed

+21
-29
lines changed

2 files changed

+21
-29
lines changed

Sources/PostgresKit/PostgresDialect.swift

+7-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ public struct PostgresDialect: SQLDialect {
99
return SQLRaw("\"")
1010
}
1111

12-
public var literalStringQuote: SQLExpression {
13-
return SQLRaw("'")
14-
}
15-
1612
public func bindPlaceholder(at position: Int) -> SQLExpression {
1713
return SQLRaw("$" + position.description)
1814
}
@@ -37,4 +33,11 @@ public struct PostgresDialect: SQLDialect {
3733
public var enumSyntax: SQLEnumSyntax {
3834
.typeName
3935
}
36+
37+
public var triggerSyntax: SQLTriggerSyntax {
38+
return .init(
39+
create: [.supportsForEach, .postgreSQLChecks, .supportsCondition, .conditionRequiresParentheses, .supportsConstraints],
40+
drop: [.supportsCascade, .supportsTableName]
41+
)
42+
}
4043
}

docker-compose.yml

+14-25
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,24 @@
1-
version: '2'
1+
version: '3.7'
22

3-
services:
4-
psql-11:
5-
image: postgres:11
6-
environment:
3+
x-common: &common
4+
environment:
75
POSTGRES_USER: vapor_username
86
POSTGRES_DB: vapor_database
97
POSTGRES_PASSWORD: vapor_password
10-
ports:
11-
- 5432:5432
8+
ports:
9+
- 5432:5432
10+
11+
services:
12+
psql-11:
13+
<<: *common
14+
image: postgres:11
1215
psql-10:
16+
<<: *common
1317
image: postgres:10
14-
environment:
15-
POSTGRES_USER: vapor_username
16-
POSTGRES_DB: vapor_database
17-
POSTGRES_PASSWORD: vapor_password
18-
ports:
19-
- 5432:5432
2018
psql-9:
19+
<<: *common
2120
image: postgres:9
22-
environment:
23-
POSTGRES_USER: vapor_username
24-
POSTGRES_DB: vapor_database
25-
POSTGRES_PASSWORD: vapor_password
26-
ports:
27-
- 5432:5432
2821
psql-ssl:
22+
<<: *common
2923
image: scenecheck/postgres-ssl:latest
30-
environment:
31-
POSTGRES_USER: vapor_username
32-
POSTGRES_DB: vapor_database
33-
POSTGRES_PASSWORD: vapor_password
34-
ports:
35-
- 5432:5432
24+

0 commit comments

Comments
 (0)