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
2 years ago
|
# frozen_string_literal: true
|
||
|
|
||
2 years ago
|
require "sequel/core"
|
||
2 years ago
|
require "sequel/model"
|
||
|
|
||
2 years ago
|
DB = Sequel.connect(ENV.delete("DATABASE_URL"))
|
||
|
|
||
2 years ago
|
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"
|
||
2 years ago
|
Sequel::Model.plugin :timestamps, update_on_create: true
|
||
2 years ago
|
Sequel::Model.plugin :update_or_create
|
||
2 years ago
|
|
||
|
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
|