-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Windows) build issues and contributing docs (#1458)
- Loading branch information
1 parent
37f4a3b
commit aade41d
Showing
12 changed files
with
59 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* text=auto eol=lf | ||
|
||
*.bat text=auto eol=crlf |
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
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
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
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
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,16 +1,31 @@ | ||
import { Pool } from 'pg'; | ||
|
||
const USERNAME = 'postgres'; | ||
const PASSWORD = 'abc123'; | ||
const USERNAME = process.env.ZENSTACK_TEST_DB_USER || 'postgres'; | ||
const PASSWORD = process.env.ZENSTACK_TEST_DB_PASS || 'abc123'; | ||
const CONNECTION_DB = process.env.ZENSTACK_TEST_DB_NAME || 'postgres'; | ||
const HOST = process.env.ZENSTACK_TEST_DB_HOST || 'localhost'; | ||
const PORT = (process.env.ZENSTACK_TEST_DB_PORT ? parseInt(process.env.ZENSTACK_TEST_DB_PORT) : null) || 5432; | ||
|
||
function connect() { | ||
return new Pool({ | ||
user: USERNAME, | ||
password: PASSWORD, | ||
database: CONNECTION_DB, | ||
host: HOST, | ||
port: PORT | ||
}); | ||
} | ||
|
||
export async function createPostgresDb(db: string) { | ||
const pool = new Pool({ user: USERNAME, password: PASSWORD }); | ||
const pool = connect(); | ||
await pool.query(`DROP DATABASE IF EXISTS "${db}";`); | ||
await pool.query(`CREATE DATABASE "${db}";`); | ||
return `postgresql://${USERNAME}:${PASSWORD}@localhost:5432/${db}`; | ||
await pool.end(); | ||
return `postgresql://${USERNAME}:${PASSWORD}@${HOST}:${PORT}/${db}`; | ||
} | ||
|
||
export async function dropPostgresDb(db: string) { | ||
const pool = new Pool({ user: USERNAME, password: PASSWORD }); | ||
const pool = connect(); | ||
await pool.query(`DROP DATABASE IF EXISTS "${db}";`); | ||
await pool.end(); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.