包含标签 postgres 的文章

Postgres 备份与恢复

背景 有时候我们需要备份 schema或者包括数据,然后恢复到另外一个postgres db中。 备份 可以使用 pg_dump 来备份,或者加上 –schema-only 只备份schema. pg_dump --file "/root/repo/uat-copy.tar" --host "db host name" --port "23123" --username "admin" --password --verbose --format=t --blobs --schema-only "compose" 恢复 同样的,可以使用pg_restore来恢复 pg_restore --host "hostname here" --port "31090" --username "usernamehere" --password --dbname "ibmclouddb" --verbose "/root/repo/uat-copy.tar" 不管备份还是恢复,都会要求输入密……

阅读全文

Go Gorm 操作数据库

Go/Gorm 操作 Postgres 虽然go提供了database/sql包来操作数据库,但是如果有个ORM的包,可以直接操作model来操作数据库,就像node里面的sequelize,是不是 也是挺好的。Gorm就实现了这个功能,这个包目前是github上star数最多的go orm包,包括中文资料,对小伙……

阅读全文