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