mirror of
https://gitee.com/dgiiot/dgiot.git
synced 2024-11-29 18:57:41 +08:00
feat: pre-ci
This commit is contained in:
parent
f338709167
commit
b1a0c59b6b
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
acl=$1
|
||||
tables=(_Role Category Channel Device Dict Evidence Files Instruct Maintenance Menu Notification Permission Product ProductTemplet View)
|
||||
tables=(_Role _User Category Channel Device Dict Evidence Files Instruct Maintenance Menu Notification Permission Product ProductTemplet View)
|
||||
echo ${#tables[@]}
|
||||
rm -rf /home/station/postgres
|
||||
mkdir -p /home/station/postgres
|
||||
@ -9,15 +9,14 @@ chown -R postgres:postgres /home/station/postgres
|
||||
|
||||
for i in ${tables[@]}; do
|
||||
echo $i
|
||||
psql -U postgres -d parse -c "COPY (SELECT * FROM \"$i\" where _rperm && array['*','role:$1']) TO '/home/station/postgres/$i.csv' WITH CSV HEADER;"
|
||||
sudo -u postgres /usr/local/pgsql/12/bin/psql -U postgres -d parse -c "COPY \"$i\" TO '/home/station/postgres/$i.csv' WITH CSV HEADER;"
|
||||
|
||||
done
|
||||
|
||||
relations=(_User _Join:children:Product _Join:deletedBy:Notification _Join:menus:_Role _Join:product:Channel _Join:products:_Role _Join:readBy:Notification _Join:role:_User _Join:roles:_Role _Join:roles:_User _Join:rules:_Role _Join:users:_Role _Join:users:_Session _Join:views:_Role)
|
||||
relations=(_Join:children:Product _Join:deletedBy:Notification _Join:menus:_Role _Join:product:Channel _Join:products:_Role _Join:readBy:Notification _Join:role:_User _Join:roles:_Role _Join:roles:_User _Join:rules:_Role _Join:users:_Role _Join:users:_Session _Join:views:_Role)
|
||||
mkdir -p /home/station/postgres/relations
|
||||
chown -R postgres:postgres /home/station/postgres/relations
|
||||
for i in ${relations[@]}; do
|
||||
echo $i
|
||||
psql -U postgres -d parse -c "COPY \"$i\" TO '/home/station/postgres/relations/$i.csv' WITH CSV HEADER;"
|
||||
|
||||
sudo -u postgres /usr/local/pgsql/12/bin/psql -U postgres -d parse -c "COPY \"$i\" TO '/home/station/postgres/relations/$i.csv' WITH CSV HEADER;"
|
||||
done
|
||||
|
@ -3,14 +3,16 @@
|
||||
filename=$1
|
||||
cd /data/dgiot/dgiot/lib/dgiot_api-4.3.0/priv/www/upload
|
||||
tar -zxvf ${filename}
|
||||
tables=(_Role Category Channel Device Dict Evidence Files Instruct Maintenance Menu Notification Permission Product ProductTemplet View)
|
||||
tables=(_Role _User Category Channel Device Dict Evidence Files Instruct Maintenance Menu Notification Permission Product ProductTemplet View)
|
||||
chown -R postgres:postgres /data/dgiot/dgiot/lib/dgiot_api-4.3.0/priv/www/upload/station/postgres/
|
||||
|
||||
for i in ${tables[@]}; do
|
||||
psql -U postgres -d parse -c "COPY \"$i\" FROM '/data/dgiot/dgiot/lib/dgiot_api-4.3.0/priv/www/upload/station/postgres/$i.csv' WITH HEADER CSV;"
|
||||
sudo -u postgres /usr/local/pgsql/12/bin/psql -U postgres -d parse -c "TRUNCATE \"$i\";"
|
||||
sudo -u postgres /usr/local/pgsql/12/bin/psql -U postgres -d parse -c "COPY \"$i\" FROM '/data/dgiot/dgiot/lib/dgiot_api-4.3.0/priv/www/upload/station/postgres/$i.csv' WITH HEADER CSV;"
|
||||
done
|
||||
|
||||
relations=(_Join:children:Product _Join:deletedBy:Notification _Join:menus:_Role _Join:product:Channel _Join:products:_Role _Join:readBy:Notification _Join:role:_User _Join:roles:_Role _Join:roles:_User _Join:rules:_Role _Join:users:_Role _Join:users:_Session _Join:views:_Role _User)
|
||||
relations=(_Join:children:Product _Join:deletedBy:Notification _Join:menus:_Role _Join:product:Channel _Join:products:_Role _Join:readBy:Notification _Join:role:_User _Join:roles:_Role _Join:roles:_User _Join:rules:_Role _Join:users:_Role _Join:users:_Session _Join:views:_Role)
|
||||
for i in ${relations[@]}; do
|
||||
psql -U postgres -d parse -c "COPY \"$i\" FROM '/data/dgiot/dgiot/lib/dgiot_api-4.3.0/priv/www/upload/station/postgres/relations/$i.csv' WITH HEADER CSV;"
|
||||
sudo -u postgres /usr/local/pgsql/12/bin/psql -U postgres -d parse -c "TRUNCATE \"$i\";"
|
||||
sudo -u postgres /usr/local/pgsql/12/bin/psql -U postgres -d parse -c "COPY \"$i\" FROM '/data/dgiot/dgiot/lib/dgiot_api-4.3.0/priv/www/upload/station/postgres/relations/$i.csv' WITH HEADER CSV;"
|
||||
done
|
||||
|
@ -8,7 +8,6 @@ cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
|
||||
EMQX_APP='apps/'
|
||||
EMQX_LIBCE_PATH='lib-ce/'
|
||||
DGIOT_DASHBOARD_PATH='apps/dgiot_api/priv'
|
||||
|
||||
get_lib_ce(){
|
||||
cd ${EMQX_LIBCE_PATH}
|
||||
if [ ! -d "emqx_dashboard/" ]; then
|
||||
@ -26,18 +25,6 @@ get_lib_ce(){
|
||||
cd ..
|
||||
}
|
||||
|
||||
get_dgiot_dashboard(){
|
||||
if [ -d "$DGIOT_DASHBOARD_PATH/www" ]; then
|
||||
echo "dgiot_dashboard exist"
|
||||
else
|
||||
wget ${FILESEVER}/www.tar.gz
|
||||
tar xvf www.tar.gz
|
||||
mv www "$DGIOT_DASHBOARD_PATH/"
|
||||
rm www.tar.gz -rf
|
||||
chmod 777 ./scripts/*
|
||||
fi
|
||||
}
|
||||
|
||||
get_apps() {
|
||||
cd ${EMQX_APP}
|
||||
|
||||
@ -93,6 +80,5 @@ get_apps() {
|
||||
|
||||
echo "ci"
|
||||
get_apps
|
||||
get_dgiot_dashboard
|
||||
get_lib_ce
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user