Dir scaffold

This commit is contained in:
VetheonGames 2023-09-18 16:53:11 -06:00
parent 0390bcc06f
commit 96416369f9
10 changed files with 61 additions and 0 deletions

7
Gemfile Normal file
View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
source "https://rubygems.org"
# gem "rails"
gem "sequel", "~> 5.72"

15
Gemfile.lock Normal file
View 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

View File

View File

View 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

View 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
View File

View File

View File

View File