فهرست منبع

:bug: fix postgresql owner grant

Jeremy Zheng 3 سال پیش
والد
کامیت
97058385b2

+ 1 - 1
documents/development/README.md

@@ -14,7 +14,7 @@
 
 ### VS Code 配置文件
 
-## [Spring 开发环境](SPRING.md)
+## [Spring 开发环境](spring/)
 
 ## [Local 开发环境](LOCAL.md)
 

+ 12 - 0
documents/development/SPRING.md → documents/development/spring/README.md

@@ -10,6 +10,18 @@
 ssh -i YOUR_KEY YOUR_ID@YOUR_ID.spring.wikipali.org
 ```
 
+## 数据库设置
+
+![files](files.png)
+
+```bash
+cd /workspace/shared/db-TIMASTAMP/
+psql -q -h 127.0.0.1 -p 5432 -U YOUR_ID YOUR_ID_mint < schema.sql
+pg_restore -Fc -h 127.0.0.1 -p 5432 -U YOUR_ID -d YOUR_ID_mint < data.dump
+```
+
+![restore](restore.png)
+
 ## PHP 开发(以用户 xxx 为例)
 
 - `~/www/htdocs/info.php` => `https://YOUR_ID.spring.wikipali.org/info.php`

BIN
documents/development/spring/files.png


BIN
documents/development/spring/restore.png


+ 1 - 2
scripts/spring/postgresql/create.sh

@@ -9,9 +9,8 @@ then
 fi
 
 psql << EOF
-CREATE DATABASE $1_mint WITH ENCODING = 'UTF8';
 CREATE USER $1 WITH PASSWORD '$2';
-GRANT ALL PRIVILEGES ON DATABASE $1_mint TO $1;
+CREATE DATABASE $1_mint WITH ENCODING = 'UTF8' OWNER $1;
 EOF
 
 echo "done($1)."

+ 1 - 2
scripts/spring/postgresql/reset.sh

@@ -10,8 +10,7 @@ fi
 
 psql << EOF
 DROP DATABASE $1_mint;
-CREATE DATABASE $1_mint WITH ENCODING = 'UTF8';
-GRANT ALL PRIVILEGES ON DATABASE $1_mint TO $1;
+CREATE DATABASE $1_mint WITH ENCODING = 'UTF8' OWNER $1;
 EOF
 
 echo "done($1)."