instalar groupdate

This commit is contained in:
f 2022-03-24 10:22:29 -03:00
parent 2e8a75e97e
commit eb290338b5
3 changed files with 18 additions and 0 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "db/groupdate"]
path = db/groupdate
url = https://github.com/ankane/groupdate.sql

1
db/groupdate Submodule

@ -0,0 +1 @@
Subproject commit e8eaa5b42d9e0ccd1628240a8b86ceb975ed4205

View file

@ -0,0 +1,14 @@
# frozen_string_literal: true
# Instala las funciones de agrupamiento por fecha
class Groupdate < ActiveRecord::Migration[6.1]
def up
groupdate = File.read(Rails.root.join('db', 'groupdate', 'postgresql', 'install.sql')).sub(/(BEGIN|COMMIT);/, ''
ActiveRecord::Base.connection.execute(groupdate)
end
def down
groupdate = File.read(Rails.root.join('db', 'groupdate', 'postgresql', 'uninstall.sql')).sub(/(BEGIN|COMMIT);/, ''
ActiveRecord::Base.connection.execute(groupdate)
end
end