Skip to content
This repository was archived by the owner on Mar 3, 2020. It is now read-only.

Commit 91f58e0

Browse files
committed
Merge branch 'master' into feature
2 parents b389171 + 2195d9c commit 91f58e0

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

velog-backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"migrate": "NODE_PATH=src babel-node src/scripts/migrate --plugins transform-es2015-modules-commonjs,transform-object-rest-spread,transform-async-to-generator --presets flow",
99
"deploy:dev": "sls deploy --stage dev",
1010
"deploy": "sls deploy --stage prod",
11-
"deploy:local": "./scripts/loadenv && sls deploy --stage prod",
11+
"deploy:local": ". ./scripts/loadenv && sls deploy --stage prod",
1212
"prettier:watch": "onchange '**/*.js' -- prettier-eslint --write {{changed}}"
1313
},
1414
"devDependencies": {

velog-backend/serverless.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ provider:
1919
REDIS_HOST: ${env:REDIS_HOST}
2020
REDIS_PASS: ${env:REDIS_PASS}
2121
INTERNAL_KEY: ${env:INTERNAL_KEY}
22+
POSTGRES_HOST: ${env:POSTGRES_HOST}
23+
POSTGRES_USER: ${env:POSTGRES_USER}
24+
POSTGRES_PW: ${env:POSTGRES_PW}
2225
NODE_ENV: "production"
2326
iamRoleStatements:
2427
- Effect: "Allow"
@@ -65,6 +68,7 @@ functions:
6568
vpc:
6669
securityGroupIds:
6770
- sg-5bc57830
71+
- sg-056b9986a73e2f766
6872
subnetIds:
6973
- subnet-91481ef9
7074
- subnet-4f59dc03

velog-backend/src/database/db.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
// @flow
2-
import SequelizeCockroach from 'sequelize-cockroachdb';
3-
import type Sequelize from 'sequelize';
2+
import Sequelize from 'sequelize';
43
import pg from 'pg';
54

65
(pg: any).defaults.parseInt8 = true; // fixes issue: umbers returning as string.
76

8-
const { COCKROACHDB_HOST, COCKROACHDB_PW } = process.env;
9-
const db: Sequelize = new SequelizeCockroach('velog', 'velog', COCKROACHDB_PW, {
10-
host: COCKROACHDB_HOST,
7+
const {
8+
COCKROACHDB_HOST,
9+
COCKROACHDB_PW,
10+
POSTGRES_HOST,
11+
POSTGRES_USER,
12+
POSTGRES_PW,
13+
} = process.env;
14+
const db: Sequelize = new Sequelize('velog', POSTGRES_USER, POSTGRES_PW, {
15+
host: POSTGRES_HOST || '',
1116
dialect: 'postgres',
12-
port: 26257,
13-
logging: process.env.NODE_ENV === 'development',
14-
ssl: true,
15-
dialectOptions: {
16-
ssl: true,
17-
supportBigNumbers: true,
18-
},
1917
define: {
2018
underscored: true,
2119
},
2220
pool: {
2321
max: 5,
2422
min: 0,
25-
acquire: 10000,
23+
acquire: 30000,
2624
idle: 10000,
2725
},
2826
});

velog-backend/src/database/models/PostsTags.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ PostsTags.getPostsCount = async ({ userId }: GetPostsCountParams) => {
9292
INNER JOIN posts AS p ON p.id = pt.fk_post_id
9393
WHERE p.fk_user_id = $userId
9494
AND p.is_temp = FALSE
95-
) GROUP BY tag
95+
) as q GROUP BY tag
9696
ORDER BY count DESC, tag
9797
`;
9898
try {

0 commit comments

Comments
 (0)