https://github.com/pyk/relieve
relieve endpoint
https://github.com/pyk/relieve
Last synced: about 1 year ago
JSON representation
relieve endpoint
- Host: GitHub
- URL: https://github.com/pyk/relieve
- Owner: pyk
- License: mit
- Created: 2015-03-27T14:20:24.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-06-08T00:47:27.000Z (about 11 years ago)
- Last Synced: 2025-02-07T17:23:15.323Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 289 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Relieve endpoint
## Development
1. setup postgres database with the following [schema][schema]
```
sudo su - postgres
createuser -P relieve
createdb -O relieve relieve
note:
update pg_hba.conf from
local all all peer
to
local all all md5
psql -U relieve -d relieve
```
2. export port and datatabase environment variable
```
export PORT=4000
export DATABASE_URL=postgres://relieve:relieve@localhost/relieve
```
3. Build & run it
```
go install
relieve
```
4. start testing endpoint
## Deploy to heroku
Create app with custom buildpack
heroku apps:create relieve-endpoint -b https://github.com/kr/heroku-buildpack-go.git
echo 'web: relieve' > Procfile
heroku addons:add heroku-postgresql
Push code to heroku
godep save
git add . && git commit -m "deploy to heroku"
git push heroku master
Make sure [godep][godep] installed
go get github.com/tools/godep
[godep]: https://github.com/tools/godep
Update heroku database
heroku pg:psql
and create the following [schema][schema]
[schema]: https://github.com/pyk/relieve/blob/master/database/schema.sql
## Database
Change column type `text` to `integer`
ALTER TABLE psikologs
ALTER COLUMN psikolog_wisdom TYPE integer USING cast(psikolog_wisdom as int);
Add default to existing columns
ALTER TABLE posts
ALTER COLUMN post_date SET DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE psikologs
ALTER COLUMN psikolog_wisdom SET DEFAULT 0;
ALTER TABLE posts
ALTER COLUMN post_report_count SET DEFAULT 0;
ALTER TABLE comments
ALTER COLUMN comment_date SET DEFAULT CURRENT_TIMESTAMP;