-
Notifications
You must be signed in to change notification settings - Fork 1
/
rakefile
25 lines (21 loc) · 940 Bytes
/
rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true
require 'rom/sql/rake_task'
require_relative 'payroll'
namespace :db do
task :setup do
connection_uri = Relational::PostgresqlDatabase.connection_uri(Relational::PostgresqlDatabase.connection_options)
config = ROM::Configuration.new(:sql, connection_uri, {})
ROM::SQL::RakeSupport.env = ROM.container(config)
end
# task :drop do
# Sequel.connect(Relational::PostgresqlDatabase.connection_uri(Relational::PostgresqlDatabase.connection_options.reject{|k,v|k == 'database'})) do |db|
# db.execute "DROP DATABASE IF EXISTS #{Relational::PostgresqlDatabase.connection_options['database']}"
# end
# end
#
# task :create do
# Sequel.connect(Relational::PostgresqlDatabase.connection_uri(Relational::PostgresqlDatabase.connection_options)) do |db|
# db.execute "CREATE DATABASE #{Relational::PostgresqlDatabase.connection_options['database']}"
# end
# end
end