Skip to content

Commit

Permalink
Add missing views for Mariadb
Browse files Browse the repository at this point in the history
  • Loading branch information
austinkregel committed Feb 7, 2025
1 parent 7be6338 commit a6d4307
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 0 deletions.
11 changes: 11 additions & 0 deletions resources/views/ssh/services/database/mariadb/backup.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if ! sudo DEBIAN_FRONTEND=noninteractive mysqldump -u root {{ $database }} > {{ $file }}.sql; then
echo 'VITO_SSH_ERROR' && exit 1
fi

if ! DEBIAN_FRONTEND=noninteractive zip {{ $file }}.zip {{ $file }}.sql; then
echo 'VITO_SSH_ERROR' && exit 1
fi

if ! rm {{ $file }}.sql; then
echo 'VITO_SSH_ERROR' && exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if ! sudo mysql -e "CREATE USER IF NOT EXISTS '{{ $username }}'@'{{ $host }}' IDENTIFIED BY '{{ $password }}'"; then
echo 'VITO_SSH_ERROR' && exit 1
fi

if ! sudo mysql -e "FLUSH PRIVILEGES"; then
echo 'VITO_SSH_ERROR' && exit 1
fi

echo "Command executed"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if ! sudo mysql -e "CREATE DATABASE IF NOT EXISTS {{ $name }} CHARACTER SET utf8 COLLATE utf8_general_ci"; then
echo 'VITO_SSH_ERROR' && exit 1
fi

echo "Command executed"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if ! sudo mysql -e "DROP USER IF EXISTS '{{ $username }}'@'{{ $host }}'"; then
echo 'VITO_SSH_ERROR' && exit 1
fi

if ! sudo mysql -e "FLUSH PRIVILEGES"; then
echo 'VITO_SSH_ERROR' && exit 1
fi

echo "Command executed"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if ! sudo mysql -e "DROP DATABASE IF EXISTS {{ $name }}"; then
echo 'VITO_SSH_ERROR' && exit 1
fi

echo "Command executed"
9 changes: 9 additions & 0 deletions resources/views/ssh/services/database/mariadb/link.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if ! sudo mysql -e "GRANT ALL PRIVILEGES ON {{ $database }}.* TO '{{ $username }}'@'{{ $host }}'"; then
echo 'VITO_SSH_ERROR' && exit 1
fi

if ! sudo mysql -e "FLUSH PRIVILEGES"; then
echo 'VITO_SSH_ERROR' && exit 1
fi

echo "Linking to {{ $database }} finished"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if ! sudo mysql -e "REVOKE ALL PRIVILEGES, GRANT OPTION FROM '{{ $username }}'@'{{ $host }}'"; then
echo 'VITO_SSH_ERROR' && exit 1
fi

echo "Command executed"

0 comments on commit a6d4307

Please sign in to comment.