Skip to content

Commit 20db663

Browse files
author
Elin Angelow
committed
fix: init
1 parent 8b522df commit 20db663

File tree

3 files changed

+22
-32
lines changed

3 files changed

+22
-32
lines changed

examples/postgresql/example.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ module.exports = {
77
},
88
link: {
99
gluePrefix: '.',
10-
schema: ['a', 'b'] // schemas allowed
10+
schema: ['public'] // schemas allowed
1111
}
1212
};

examples/postgresql/example.sql

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
1-
CREATE TYPE LessonType AS TABLE (LessonId INT, LessonName VARCHAR(100))
2-
3-
CREATE TABLE Lesson (
4-
Id INT PRIMARY KEY,
5-
LName VARCHAR(50)
6-
)
7-
-------------------------
8-
CREATE PROCEDURE Usp_InsertLesson
9-
@ParLessonType LessonType READONLY,
10-
@ParLessonType2 LessonType READONLY
1+
CREATE TABLE "some-test-example"."exsschema"."tx" (
2+
tag serial PRIMARY KEY,
3+
device VARCHAR (100) NOT NULL,
4+
created BIGINT DEFAULT extract(epoch from now())
5+
);
6+
---------------------------------------------------------------
7+
CREATE FUNCTION "some-test-example"."exsschema"."fnLastTx"(pDevice VARCHAR (100))
8+
RETURNS table (tag integer, created BIGINT)
119
AS
12-
INSERT INTO Lesson
13-
SELECT * FROM @ParLessonType;
14-
15-
CREATE PROCEDURE Usp_InsertLesson2
16-
@ParLessonType LessonType READONLY,
17-
@ParLessonType2 LessonType READONLY
10+
$$
11+
SELECT tag, created FROM "some-test-example"."exsschema"."tx" WHERE tag = (SELECT MAX(tag) AS tag FROM "some-test-example"."exsschema"."tx" WHERE device = pDevice);
12+
$$
13+
LANGUAGE sql;
14+
---------------------------------------------------------------
15+
CREATE FUNCTION "some-test-example"."exsschema"."fnNewTx"(pDevice VARCHAR (100), pCreated BIGINT)
16+
RETURNS table (tag integer, created BIGINT)
1817
AS
19-
INSERT INTO Lesson
20-
SELECT * FROM @ParLessonType
21-
-------------------------
22-
DECLARE @VarLessonType AS LessonType
23-
24-
INSERT INTO @VarLessonType VALUES ( 1, 'Math')
25-
INSERT INTO @VarLessonType VALUES ( 2, 'Science')
26-
INSERT INTO @VarLessonType VALUES ( 3, 'Geometry')
27-
28-
29-
EXECUTE Usp_InsertLesson @VarLessonType
30-
-------------------------
31-
-------------------------
32-
-------------------------
18+
$$
19+
INSERT INTO "some-test-example"."exsschema"."tx" (device, created) VALUES (pDevice, pCreated) RETURNING tag, created;
20+
$$
21+
LANGUAGE sql;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
},
88
"dependencies": {
99
"error": "^10.4.0",
10-
"mssql": "10.0.1"
10+
"mssql": "10.0.1",
11+
"postgres": "3.4.3"
1112
},
1213
"devDependencies": {
1314
"tap": "*",

0 commit comments

Comments
 (0)