This repository has been archived by the owner on Jan 16, 2022. It is now read-only.
-
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.
chore: Stop running migrations automatically, run migrations by hand. (…
…#452) * Cause migrations to be manually applied by default * Log current server name * Update apollos-church-api/package.json * Update migration documentation * Update README.md * Update README.md * Github editor + find in file = text getting butchered Co-authored-by: Michael Neeley <micneeley14@gmail.com>
- Loading branch information
1 parent
4e284b6
commit 14ac8c6
Showing
4 changed files
with
62 additions
and
1 deletion.
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
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,31 @@ | ||
import dotenv from 'dotenv/config'; // eslint-disable-line | ||
import '@apollosproject/data-connector-postgres/lib/postgres/pgEnum-fix'; | ||
import config from './config'; // eslint-disable-line | ||
|
||
import ApollosConfig from '@apollosproject/config'; | ||
import { createMigrationRunner } from '@apollosproject/data-connector-postgres'; | ||
|
||
let dataObj; | ||
|
||
if (ApollosConfig?.DATABASE?.URL) { | ||
dataObj = require('./data/index.postgres'); | ||
} else { | ||
dataObj = require('./data/index'); | ||
} | ||
|
||
const { migrations } = dataObj; | ||
|
||
// make sure this is called last. | ||
// (or at least after the apollos server setup) | ||
(async () => { | ||
if (ApollosConfig?.DATABASE?.URL) { | ||
try { | ||
const migrationRunner = await createMigrationRunner({ migrations }); | ||
migrationRunner.runAsCLI(); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
} else { | ||
console.warn('Please specify a database URL to perform migrations'); | ||
} | ||
})(); |
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