travis: fix postgres import

This commit is contained in:
Nolan Lawson 2018-04-10 16:58:17 -07:00
parent 07ea5e7c57
commit 36af90506f
2 changed files with 5 additions and 4 deletions

View File

@ -45,7 +45,7 @@ before_install:
- node --version
- postgres --version
- redis-server --version
- psql -c "CREATE USER nolan CREATEDB;"
- psql -d template1 -c "CREATE USER nolan CREATEDB;"
before_script:
- npm run lint
script: npm run test-browser

View File

@ -21,6 +21,7 @@ const envFile = `
PAPERCLIP_SECRET=foo
SECRET_KEY_BASE=bar
OTP_SECRET=foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobar
DB_HOST=127.0.0.1
DB_PORT=${process.env.PGPORT || 5432}
DB_USER=${DB_USER}
`
@ -43,12 +44,12 @@ async function cloneMastodon () {
async function setupMastodonDatabase () {
console.log('Setting up mastodon database...')
try {
await exec(`dropdb -U ${DB_USER} mastodon_development`, {cwd: mastodonDir})
await exec(`dropdb -h 127.0.0.1 -U ${DB_USER} mastodon_development`, {cwd: mastodonDir})
} catch (e) { /* ignore */ }
await exec(`createdb -U ${DB_USER} mastodon_development`, {cwd: mastodonDir})
await exec(`createdb -h 127.0.0.1 -U ${DB_USER} mastodon_development`, {cwd: mastodonDir})
let dumpFile = path.join(dir, '../fixtures/dump.sql')
await exec(`pg_restore -U ${DB_USER} -Fc -d mastodon_development "${dumpFile}"`, {cwd: mastodonDir})
await exec(`pg_restore -h 127.0.0.1 -U ${DB_USER} -Fc -d mastodon_development "${dumpFile}"`, {cwd: mastodonDir})
let tgzFile = path.join(dir, '../fixtures/system.tgz')
let systemDir = path.join(mastodonDir, 'public/system')