Dir scaffold
This commit is contained in:
parent
0390bcc06f
commit
96416369f9
7
Gemfile
Normal file
7
Gemfile
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
# gem "rails"
|
||||||
|
|
||||||
|
gem "sequel", "~> 5.72"
|
15
Gemfile.lock
Normal file
15
Gemfile.lock
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
bigdecimal (3.1.4)
|
||||||
|
sequel (5.72.0)
|
||||||
|
bigdecimal
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
sequel (~> 5.72)
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.4.10
|
0
bin/start_repoquest_server.rb
Normal file
0
bin/start_repoquest_server.rb
Normal file
0
config/repoquest_database.yml
Normal file
0
config/repoquest_database.yml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# db/migrations/001_create_users_and_xp_gain_tables.rb
|
||||||
|
Sequel.migration do
|
||||||
|
up do
|
||||||
|
create_table(:users) do
|
||||||
|
primary_key :id
|
||||||
|
String :user_id, unique: true
|
||||||
|
String :username
|
||||||
|
Integer :current_level
|
||||||
|
Integer :total_xp
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table(:xp_gain) do
|
||||||
|
primary_key :id
|
||||||
|
String :commit_id
|
||||||
|
Integer :xp_gained
|
||||||
|
DateTime :time_of_gain
|
||||||
|
Integer :total_gains
|
||||||
|
foreign_key :user_id, :users
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
down do
|
||||||
|
drop_table(:xp_gain)
|
||||||
|
drop_table(:users)
|
||||||
|
end
|
||||||
|
end
|
13
lib/database/repoquest_db_connector.rb
Normal file
13
lib/database/repoquest_db_connector.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# lib/database/repoquest_db_connector.rb
|
||||||
|
require 'sequel'
|
||||||
|
|
||||||
|
class RepoQuestDBConnector
|
||||||
|
def initialize(db_file = 'sqlite://repoquest.db')
|
||||||
|
@db = Sequel.connect(db_file)
|
||||||
|
end
|
||||||
|
|
||||||
|
def run_migrations
|
||||||
|
Sequel.extension :migration
|
||||||
|
Sequel::Migrator.run(@db, 'db/migrations/')
|
||||||
|
end
|
||||||
|
end
|
0
lib/repoquest_server.rb
Normal file
0
lib/repoquest_server.rb
Normal file
0
lib/websocket/repoquest_frame_parser.rb
Normal file
0
lib/websocket/repoquest_frame_parser.rb
Normal file
0
lib/websocket/repoquest_handshake.rb
Normal file
0
lib/websocket/repoquest_handshake.rb
Normal file
0
logs/repoquest_server.log
Normal file
0
logs/repoquest_server.log
Normal file
Loading…
Reference in New Issue
Block a user