User Tools

Site Tools


Writing /var/www/html/conf/plugins.local.php failed
notes:postgres
-- basic access by nix user
CREATE ROLE josh WITH login;
CREATE DATABASE edc owner josh;
bcp "[Event]" out Event.data -S (localdb)\Projects -T -d EDC -c -t 0xfe -r 0xf7 -C RAW -k
#!/bin/bash
 
for f in *.data; do
	echo $f
	cat $f | \
		sed 's/\xf7/|\n|/g' | \
		# remove extra at end of file
		sed '$ s/.$//' | \
		# add missing at start of file
		sed '1 s/^/|/' | \
		sed 's/"/""/g' | \
		sed 's/^|\||$/"/g' | \
		sed 's/\xfe/","/g' | \
		sed 's/,"",/,,/g' | \
		sed 's/,"",/,,/g' | \
		sed 's/,""$/,/g' | \
		sed 's/\\/\\\\/g' | \
		# dos2unix identified these non-char bytes
		tr -d '\31\20\16\0' | \
		# dos2unix | \
		iconv -f WINDOWS-1252 -t UTF8 > $f.csv
done
\copy event (id,name,partner_id,city_id,module_id,region_id,start_date,dyno,loc_code,event_type_id,event_code,end_date,address,postal_code,max_pre_reg,lat,lng,directions_url,pre_reg_close_time,sms_message,private,campaign_id) FROM 'Event.data.csv' csv
SELECT SETVAL('event_id_seq', (SELECT MAX(id) FROM event));
notes/postgres.txt · Last modified: 2015/08/17 14:05 by jiggak