First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel
Then ssh with root account, run this in termianl:
$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
parent=$1 | |
if [ -z $1 ]; then | |
echo "Parent db is empty" | |
echo "Using master" | |
parent="development_master" | |
fi | |
repo=`git rev-parse --abbrev-ref HEAD` | |
db=$(echo "development_$repo" | tr "-" "_") | |
echo 'Creating dev db' |
# run in your psql console | |
# | |
# test=# SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE query='SELECT "posts".* FROM "posts"'; |
#postgresql setup | |
ssh -i ~/.ssh/id_rsa root@<domain> | |
dokku postgres:connect <db> | |
psql=# SHOW config_file; | |
-> /var/lib/postgresql/data/postgresql.conf | |
psql=# \q | |
docker ps |
# lib/tasks/db.rake | |
namespace :db do | |
desc "Dumps the database to db/APP_NAME.dump" | |
task :dump => :environment do | |
cmd = nil | |
with_config do |app, host, db, user| | |
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
end | |
puts cmd |
import Ember from 'ember'; | |
import { A } from '@ember/array'; | |
import EmberObject, { computed } from '@ember/object'; | |
const { alias } = computed; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
title: '', | |
todos: null, | |
currentItem: null, |
-- return details.approved content as text | |
select details->>'approved' from events | |
-- value (json) | |
select details -> 'title' -> 'value' as value as from events | |
-- with a specific value | |
select * from events where details->>'title' = 'some' | |
select * from events where where details -> 'title' ->> 'value' = 'some' | |
select * from events where (details-> 'approved' ->> 'value')::boolean is true |
#Find the corrupted rows | |
DO $$ | |
declare | |
curid INT := 0; | |
vcontent TEXT; | |
badid INT; | |
begin | |
FOR badid IN SELECT id FROM events LOOP | |
curid = curid + 1; |
require "benchmark" | |
require "benchmark/memory" | |
payload = { | |
"was_changed"=>0, | |
"store"=>"gp", | |
"os"=>nil, | |
"thumbs_down_cnt"=>0, | |
"manufactorer"=>nil, | |
"content"=>"The voices are so soothing. I am only six days in, but I feel good about what little I have done and what I am doing. If I remember to do so I will give an update at the end of the month.", |