Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor SQL scripts #193

Open
sean-gilliam opened this issue Nov 2, 2022 · 10 comments
Open

Refactor SQL scripts #193

sean-gilliam opened this issue Nov 2, 2022 · 10 comments
Labels
Hacktoberfest needs further research Item needs fruther research

Comments

@sean-gilliam
Copy link
Collaborator

Currently, there exists two SQL files used to set up the database. These files are rift.sql and rift_core.sql. These files are huge text splats that contain a mix of schema definitions and data. In their current state, it makes it hard to reason about or make changes to the files / tables / data.

We should think about breaking these schemas / data bits into their own files in a db directory or some other suitable named directory. While we're at it, we could format the files better and include better documentation.

Possible directory structure:

db
|-- tables
|---- bans.sql
|---- ...
|-- data
|---- bans_initial.sql
|---- ...
|-- migrations
|---- 20221101_alter_ban.sql
@Psypher9
Copy link
Collaborator

Psypher9 commented Nov 2, 2022

I agree. Are there any takers on this?

@sean-gilliam
Copy link
Collaborator Author

I was thinking about doing it unless someone else wants to take it up.

@Psypher9
Copy link
Collaborator

Psypher9 commented Nov 2, 2022

I'll hold off if you've got your eye on it

@sean-gilliam
Copy link
Collaborator Author

@Psypher9 (or anyone else) If you want to take this on, then you are more than welcome. I'm going to focus on other issues in the code for the time being.

@Psypher9
Copy link
Collaborator

Alright, sounds good! I'll see if I can make a space for it

@rezalas
Copy link
Owner

rezalas commented Oct 20, 2023

This cleans up a lot of ambiguity in the SQL data structure.

@rezalas rezalas closed this as completed Oct 20, 2023
@rezalas
Copy link
Owner

rezalas commented Oct 20, 2023

I'm building a new environment and when executing the dev-install.sh script I received a few errors during the SQL setup portion.

  • It locks during the mariadb install, so you have to ctrl+c to continue it
  • the scripts throw the following errors during data import
Importing votes data
--------------
LOCK TABLES `votes` WRITE
--------------

ERROR 1146 (42S02) at line 4 in file: 'votes.sql': Table 'mysql.votes' doesn't exist
--------------
/*!40000 ALTER TABLE `votes` DISABLE KEYS */
--------------

ERROR 1146 (42S02) at line 6 in file: 'votes.sql': Table 'mysql.votes' doesn't exist
--------------

@rezalas rezalas reopened this Oct 20, 2023
@rezalas
Copy link
Owner

rezalas commented Oct 20, 2023

Okay I see the problem, the data scripts don't use the appropriate database first. I can get this added into them.

@rezalas
Copy link
Owner

rezalas commented Oct 20, 2023

closed after minor patch

@sean-gilliam
Copy link
Collaborator Author

sean-gilliam commented Oct 22, 2023

Lessons learned from previous attempts.

  • We need to fully understand the relationship between the database and game files before attempting another go at this.
  • After refactoring the scripts into separate files, do a clean setup install from a fresh mysql instance. Recompile the project and attempt to start the server. A clean start should ensure the refactor is successful.
  • Line that begin /*! are not comments. eg. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; and should be included in the scripts.

@sean-gilliam sean-gilliam reopened this Oct 22, 2023
@sean-gilliam sean-gilliam added the needs further research Item needs fruther research label Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest needs further research Item needs fruther research
Projects
None yet
Development

No branches or pull requests

3 participants