<commit_before>require 'sqlite3'

class Database

  def self.load_structure
    Database.execute <<-SQL
CREATE TABLE IF NOT EXISTS courses (
  id integer PRIMARY KEY AUTOINCREMENT,
  name varchar(100) NOT NULL,
  city varchar(100),
  state varchar(25)
  );
SQL
    Database.execute <<-SQL
CREATE TABLE IF NOT EXISTS reviews (
  id integer PRIMARY KEY AUTOINCREMENT,
  name varchar(100) NOT NULL,
  city varchar(100),
  state varchar(25),
  course_id integer NOT NULL,
  comment varchar(500)
  );
SQL
  end

  def self.execute(*args)
    initialize_database unless defined?(@@db)
    @@db.execute(*args)
  end

  def self.initialize_database
    environment = ENV["TEST"] ? "test" : "production"
    database = "db/disc_golf_course_tracker_#{environment}.sqlite"
    @@db = SQLite3::Database.new(database)
  end
end<commit_msg>completing a course or adding a review creates a review timestamp<commit_after>require 'sqlite3'

class Database

  def self.load_structure
    Database.execute <<-SQL
CREATE TABLE IF NOT EXISTS courses (
  id integer PRIMARY KEY AUTOINCREMENT,
  name varchar(100) NOT NULL,
  city varchar(100),
  state varchar(25)
  );
SQL
    Database.execute <<-SQL
CREATE TABLE IF NOT EXISTS reviews (
  id integer PRIMARY KEY AUTOINCREMENT,
  name varchar(100) NOT NULL,
  city varchar(100),
  state varchar(25),
  course_id integer NOT NULL,
  comment varchar(500),
  completion_date datetime DEFAULT CURRENT_TIMESTAMP
  );
SQL
  end

  def self.execute(*args)
    initialize_database unless defined?(@@db)
    @@db.execute(*args)
  end

  def self.initialize_database
    environment = ENV["TEST"] ? "test" : "production"
    database = "db/disc_golf_course_tracker_#{environment}.sqlite"
    @@db = SQLite3::Database.new(database)
  end
end
{'fraction_non_alphanumeric': 0.09726962457337884, 'fraction_numerical': 0.023890784982935155, 'mean_word_length': 4.128279883381924, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5474291', 'n_tokens_mistral': 613, 'n_tokens_neox': 554, 'n_words': 165}