Skip to content

Commit

Permalink
Merge pull request #239 from Psypher9/main
Browse files Browse the repository at this point in the history
  • Loading branch information
rezalas authored Oct 30, 2023
2 parents 1d54749 + 1c8799a commit 26b633c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 39 deletions.
11 changes: 11 additions & 0 deletions db/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Why Single files and ALSO folders?

You may find yourself in the unfortunate situation that you need to be poking around in this directory.

If that is you, first of all, welcome! Secondly, there is a reason to have the SQL files `setup`, `rift`, and `rift_core` here while also having them split up in folders and files of their own.

The reason for this is that we originally need to have these backup files split up into a more readable form to have better visibility on the structure of the databases. However, once they became the way that the `dev-install.sh` script restore the development databases, very important pieces of the database puzzle were lost and development environments could no longer load Areas.

In order to keep the visibility of table structure and the wait for it... _usability_ of the dev databases they exist together in quasi-harmony.

Cheers!
1 change: 1 addition & 0 deletions db/rift_core.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;


--
-- Table structure for table `bans`
--
Expand Down
25 changes: 0 additions & 25 deletions db/setup-vagrant.sql

This file was deleted.

14 changes: 2 additions & 12 deletions db/setup.sql
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
--
-- mariadb setup script for riftshadow
-- (FOR DEVELOPMENT ONLY)
--

-- create the required databases
CREATE DATABASE IF NOT EXISTS rift_core;
CREATE DATABASE IF NOT EXISTS rift;

-- import rift_core script into rift_core db
use rift_core;
source rift_core.sql;

-- import rift script into rift db
use rift;
source rift.sql;

--
-- create the rift user
use mysql;
DROP USER IF EXISTS 'rift'@'localhost';
CREATE USER 'rift'@'localhost' IDENTIFIED BY 'rift123';

-- grant rift user rights to access mariadb and all rights to the two dbs
GRANT USAGE ON *.* TO 'rift'@'localhost' IDENTIFIED BY 'rift123';
GRANT USAGE ON *.* TO 'rift'@'localhost';
GRANT ALL PRIVILEGES ON rift.* TO 'rift'@'localhost';
GRANT ALL PRIVILEGES ON rift_core.* TO 'rift'@'localhost';
FLUSH PRIVILEGES;
Expand Down
6 changes: 4 additions & 2 deletions dev-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ echo "${NOCOLOR}Running database scaffolding\n"
{
if [ -e ./db/setup.sql ]; then
sudo mysql -v mysql < ./db/setup.sql
elif [ -e ~/code/db/setup-vagrant.sql ]; then
sudo mysql -v mysql < ~/code/db/setup-vagrant.sql
sudo mysql -v rift_core < ./db/rift_core.sql >/dev/null 2>&1
sudo mysql -v rift < ./db/rift.sql >/dev/null 2>&1
elif [ -e ~/code/db/setup.sql ]; then
sudo mysql -v mysql < ~/code/db/setup.sql
sudo mysql -v rift_core < ~/code/db/rift_core.sql >/dev/null 2>&1
sudo mysql -v rift < ~/code/db/rift.sql >/dev/null 2>&1
~/code/admin/artisan migrate
Expand Down

0 comments on commit 26b633c

Please sign in to comment.