-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lars-Erik Roald
committed
Dec 30, 2022
1 parent
12d82b5
commit 06c993b
Showing
7 changed files
with
147 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,5 @@ services: | |
ports: | ||
- 50000:5000 | ||
tty: true | ||
entrypoint: "/home/sybase/bin/entrypoint.sh" | ||
restart: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*Spec | ||
tests | ||
.vscode | ||
.vscode | ||
.devcontainer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
const sql = ` | ||
IF | ||
EXISTS (SELECT 1 FROM | ||
sysobjects WHERE type = 'U' and name = 'orderLine') | ||
BEGIN | ||
DROP TABLE orderLine | ||
END | ||
GO | ||
IF | ||
EXISTS (SELECT 1 FROM | ||
sysobjects WHERE type = 'U' and name = 'deliveryAddress') | ||
BEGIN | ||
DROP TABLE deliveryAddress | ||
END | ||
GO | ||
IF | ||
EXISTS (SELECT 1 FROM | ||
sysobjects WHERE type = 'U' and name = '_order') | ||
BEGIN | ||
DROP TABLE _order | ||
END | ||
GO | ||
IF | ||
EXISTS (SELECT 1 FROM | ||
sysobjects WHERE type = 'U' and name = 'customer') | ||
BEGIN | ||
DROP TABLE customer | ||
END | ||
GO | ||
CREATE TABLE customer ( | ||
id int IDENTITY PRIMARY KEY, | ||
name TEXT, | ||
balance NUMERIC, | ||
isActive BIT | ||
) | ||
GO | ||
CREATE TABLE _order ( | ||
id int IDENTITY PRIMARY KEY, | ||
orderDate DATETIME, | ||
customerId INTEGER REFERENCES customer | ||
) | ||
GO | ||
CREATE TABLE orderLine ( | ||
id int IDENTITY PRIMARY KEY, | ||
orderId INTEGER REFERENCES _order, | ||
product TEXT | ||
) | ||
GO | ||
CREATE TABLE deliveryAddress ( | ||
id int IDENTITY PRIMARY KEY, | ||
orderId INTEGER REFERENCES _order, | ||
name TEXT, | ||
street TEXT, | ||
postalCode TEXT, | ||
postalPlace TEXT, | ||
countryCode TEXT | ||
) | ||
`; | ||
|
||
module.exports = async function(db) { | ||
const statements = sql.split('GO') | ||
for (let i = 0; i < statements.length; i++) { | ||
await db.query(statements[i]); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.