# frozen_string_literal: true require "sequel/core" require "sequel/model" DB = Sequel.connect(ENV.delete("DATABASE_URL")) if ENV["RACK_ENV"] == "development" Sequel::Model.cache_associations = false end Sequel::Model.plugin :auto_validations Sequel::Model.plugin :require_valid_schema Sequel::Model.plugin :subclasses unless ENV["RACK_ENV"] == "development" Sequel::Model.plugin :timestamps, update_on_create: true Sequel::Model.plugin :update_or_create if ENV["RACK_ENV"] == "development" || ENV["RACK_ENV"] == "test" require "logger" LOGGER = Logger.new($stdout) LOGGER.level = Logger::FATAL if ENV["RACK_ENV"] == "test" DB.loggers << LOGGER end