-
Notifications
You must be signed in to change notification settings - Fork 141
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
Player serialization from-and to SQL database #496
Open
sinoz
wants to merge
49
commits into
apollo-rsps:kotlin-experiments
Choose a base branch
from
sinoz:database
base: kotlin-experiments
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 35 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
b9ff3e8
Add database project including initial schema and postgres nvironment
sinoz b2eced5
Add connection pooling and use TestContainers for integration tests a…
sinoz ec93fdb
Apply feedback and expand
sinoz 3b575d4
Add title
sinoz 7988a45
Add games room skill level
sinoz e29d7b7
Add attribute table
sinoz 64607d7
Change p_owner to p_display_name
sinoz babf292
Add create_item, create_attribute procedures
sinoz 02464f6
Turn default appearance values into required procedure parameters for…
sinoz da12a6d
Add comment about reserved keyword 'position'
sinoz 54f2e6f
Use CIText for email
sinoz 54277e8
Remove character limits
sinoz 6738931
Update all limitless varchars to text
sinoz e85e261
Update ConnectionConfig to simply rely on a URL instead of separate h…
sinoz 0e368c3
Rename ConnectionPool#hikariPool to ConnectionPool#createHikariPool
sinoz 4482f54
Update appearance table to borrow the player_id as its primary key
sinoz 3dd9385
Remove duplicate create_account procedure
sinoz 17a841c
Add energy units field
sinoz 0b5a1b5
Remove all drops, add attributes as jsonb to item, add get_skills, ge…
sinoz b15f348
Add get_player function, get_appearance
sinoz 390ac79
Inventory_type -> Inventory_id
sinoz b60dcbd
Rename password -> password_hash, remove attributes field from item t…
sinoz 4ee6b29
Add last_login field, remove extra calls from create_player
sinoz 46b263f
Remove email field from returned table in get_account
sinoz ba11b2c
Turn title into a separate table
sinoz 15b47dc
Add account related domain types
sinoz 0a45ae9
Move positional coords right into the player table, apply some clean ups
sinoz 3341dac
Add player loading, account domain types
sinoz 8771571
Rename ACCOUNT_FETCH_QUERY -> GET_ACCOUNT_QUERY
sinoz cc00840
Add thieving skill
sinoz fa4ed80
Add player saving
sinoz 92bc7f4
Add in support for different types of attributes
sinoz e1f48cb
Slightly clean up JdbcPlayerSerializer
sinoz 6b6c3b6
Remove energy units and games room skill level from player table
sinoz 45bc21d
Update JdbcPlayerSerializer#putAttributes to not persist transient at…
sinoz a5e72c1
Update password in PlayerCredentials to password hash after password …
sinoz 2ee7eda
Undo the getRunEnergy() return type change
sinoz d78334a
Use Guava's MoreObjects for toString()
sinoz 02fa934
Remove value wrappers
sinoz a0a00fe
Remove entire database package
sinoz 11a43cc
Update JdbcPlayerSerializer to consume a DataSource
sinoz 3d54000
Rename Skill#getCount to Skill#count
sinoz 7e1429e
Remove redundant database module, move schema and associated files to…
sinoz 63b5b09
Update comments
sinoz 0df0d56
Fix test to not rely on Docker and instead accept JDBC url
sinoz 46f9def
Remove testcontainers dependency
sinoz 560876c
Wrap operations in JdbcPlayerSerializer#savePlayer in a transaction
sinoz f73367b
Update getRunEnergy() to return a long
sinoz 2e5c258
Move sql functions to ApolloQueries.kt
sinoz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Tell Docker to pull a Postgres 11 image running on Alpine | ||
FROM postgres:11-alpine | ||
|
||
# And then copy over the apollo.sql script into the container's entrypoint | ||
COPY apollo.sql /docker-entrypoint-initdb.d/init.sql | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Apollo - Database | ||
sinoz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Contains the database schema for the Apollo project. Start-up and tear-down scripts are included as well as Docker related files. These scripts rely on Docker so it is required to have Docker installed on your machine. This means that you may require an operating system that supports Hyper-V, which include (but are not limited to): | ||
- Windows 10 Professional+ | ||
- Linux distributions | ||
- MacOS distributions | ||
|
||
Windows 10 Home is not supported as is specified [here](https://forums.docker.com/t/installing-docker-on-windows-10-home/11722). | ||
|
||
## Running it | ||
|
||
First permit your operating system to run these scripts: | ||
|
||
``` | ||
chmod a+x ./start-db.sh | ||
chmod a+x ./stop-db.sh | ||
``` | ||
|
||
And then to start your PostgreSQL container with your database setup: | ||
|
||
``` | ||
./start-db.sh | ||
``` | ||
|
||
And to stop it: | ||
|
||
``` | ||
./stop-db.sh | ||
``` | ||
|
||
## Updating the schema | ||
You can modify the [apollo.sql](apollo.sql) script to add dummy data to your database. Note however that you are required to delete the associated volume after modifying the script to make it work: | ||
|
||
``` | ||
docker volume rm database_data | ||
``` | ||
|
||
The `start.sh` and `stop.sh` scripts do this for you as well. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to start publishing custom PostgreSQL Docker images unless we need to compile native extensions. Instead of using the containers init scripts functionality we should be using something like Flyway to run migrations on the configured database.