You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
664 B
24 lines
664 B
# 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
|