Skip create table in kstore-init if db exist

This commit is contained in:
斟酌 鵬兄 2023-09-23 23:33:01 +08:00
parent b134d89d40
commit 8e368db056
3 changed files with 7 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.DS_Store
*.prod
*.log

View File

@ -63,7 +63,8 @@ function kstore-secret {
}
function kstore-init {
cat <<___SQL___ | $_SQLITE "$_AUTH_DB"
if [ ! -f "$_AUTH_DB" ]; then
cat <<___SQL___ | $_SQLITE "$_AUTH_DB"
CREATE TABLE IF NOT EXISTS store (
key TEXT NOT NULL
, prop TEXT NOT NULL
@ -71,6 +72,8 @@ CREATE TABLE IF NOT EXISTS store (
, PRIMARY KEY( key ASC, prop ASC )
);
___SQL___
chmod 600 "$_AUTH_DB"
fi
kstore secret config
}

View File

@ -14,8 +14,8 @@ function kcontext {
docker) shift; kcontext-docker "$@" ;;
s3-arch) shift; kcontext-s3-arch "$@" ;;
*)
__func_help "k8s ..."
__func_head "s3-arch ..."
__func_head "k8s ..."
__func_help "s3-arch ..."
__func_help "docker ..."
return 1
;;