Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace :db do
- task import: :environment do
- import_path = "~/backups"
- sql_file = "PostgreSQL.sql"
- database_config = Rails.configuration.database_configuration[Rails.env]
- system "psql --username=#{database_config['username']} -no-password # {database_config['database']} < #{import_path}/#{sql_file}"
- end
- end
- must be owner of extension plpgsql //and
- no privileges could be revoked for "public"
- digoal=# copy tbl_join_1 to '/home/pg93/tbl_join_1.dmp';
- COPY 10
- digoal=# delete from tbl_join_1;
- DELETE 10
- digoal=# copy tbl_join_1 from '/home/pg93/tbl_join_1.dmp';
- COPY 10
- pg93@db-172-16-3-150-> pg_dump -f ./tbl_join_1.dmp -t tbl_join_1
- pg93@db-172-16-3-150-> psql
- psql (9.3.3)
- Type "help" for help.
- digoal=# drop table tbl_join_1;
- DROP TABLE
- digoal=# q
- pg93@db-172-16-3-150-> psql -f ./tbl_join_1.dmp
- SET
- SET
- SET
- SET
- SET
- SET
- SET
- SET
- SET
- CREATE TABLE
- ALTER TABLE
- ALTER TABLE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement