forked from sitcomlab/Ethics-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implementation of q14 (custom file upload).
WIP!
- Loading branch information
speckij
committed
Mar 24, 2018
1 parent
8861034
commit 1c7c583
Showing
30 changed files
with
540 additions
and
57 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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
var colors = require('colors'); | ||
var async = require('async'); | ||
var pg = require('pg'); | ||
var fs = require('fs'); | ||
var config = require('dotenv').config(); | ||
|
||
|
||
// DATABASE CONFIGURATION | ||
var pool = new pg.Pool({ | ||
host: process.env.POSTGRES_HOST, | ||
port: Number(process.env.POSTGRES_PORT), | ||
database: process.env.POSTGRES_DB_NAME, | ||
user: process.env.POSTGRES_USERNAME, | ||
password: process.env.POSTGRES_PASSWORD, | ||
ssl: JSON.parse(process.env.POSTGRES_SSL) | ||
}); | ||
exports.pool = pool; | ||
|
||
// Load files | ||
var dir = "/sql/migration/"; | ||
var queries = []; | ||
|
||
|
||
var query = fs.readFileSync(__dirname + dir + 'migrate_100_to_141.sql', 'utf8').toString(); | ||
|
||
// Start setup | ||
async.waterfall([ | ||
function(callback) { | ||
// Connect to database | ||
pool.connect(function(err, client, done) { | ||
if(err) { | ||
callback(err); | ||
} else { | ||
callback(null, client, done); | ||
} | ||
}); | ||
}, | ||
function(client, done, callback) { | ||
client.query(query, function(err, result) { | ||
done(); | ||
if (err) { | ||
callback(err); | ||
} else { | ||
console.log(colors.blue(query)); | ||
console.log(colors.green("Done!\n\n")); | ||
callback(null); | ||
} | ||
}); | ||
} | ||
], function(err){ | ||
// Close database connection | ||
pool.end(); | ||
|
||
if(err) { | ||
console.error(colors.red(err)); | ||
} else { | ||
console.log(colors.green("Migration successfull!")); | ||
} | ||
}); |
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 |
---|---|---|
|
@@ -19,6 +19,9 @@ footer { | |
background-color: #f5f5f5; | ||
} | ||
|
||
.flexarea { | ||
flex: 1 1 auto; | ||
} | ||
|
||
.left { | ||
text-align: left; | ||
|
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
Oops, something went wrong.