-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up database schema sync for watch mode
- Loading branch information
1 parent
3e290ee
commit ba2ef94
Showing
7 changed files
with
60 additions
and
33 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 |
---|---|---|
@@ -1,13 +1,25 @@ | ||
import { run } from '@casimir/helpers' | ||
|
||
/** Resource path from package caller */ | ||
const resources = './scripts' | ||
const resourcePath = './scripts' | ||
|
||
/** | ||
* Clean local Docker Postgres environment, sql, and pgdata. | ||
* Clean Docker containers, Postgres data, and SQL schema files. | ||
*/ | ||
void async function () { | ||
console.log(`Cleaning Docker services, Postgres data, and SQL schema files from ${resources}`) | ||
await run('docker compose -p casimir-data down -v') | ||
await run(`npx rimraf ${resources}/.out`) | ||
console.log(`Cleaning up Docker containers, Postgres data, and SQL schema files from ${resourcePath}/.out`) | ||
|
||
/** Stop postgres database */ | ||
const stackName = 'casimir-data' | ||
const containerName = `${stackName}-postgres-1` | ||
const container = await run(`docker ps -q --filter name=${containerName}`) | ||
if (container) { | ||
await run(`docker compose -p ${stackName} -f ${resourcePath}/docker-compose.yaml down`) | ||
} | ||
|
||
/** Clear output directory for pgdata and sql */ | ||
const outDir = `${resourcePath}/.out` | ||
await run(`npx rimraf ${outDir}`) | ||
|
||
console.log('🐘 Database resources cleaned') | ||
}() |
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,9 +1,8 @@ | ||
version: '3' | ||
|
||
services: | ||
pg: | ||
postgres: | ||
image: postgres:latest | ||
restart: always | ||
ports: | ||
- 5432:5432 | ||
environment: | ||
|
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