From eb290338b5dbc105d3b65a388984ce033f815f87 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 24 Mar 2022 10:22:29 -0300 Subject: [PATCH] instalar groupdate --- .gitmodules | 3 +++ db/groupdate | 1 + db/migrate/20220324131233_groupdate.rb | 14 ++++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 .gitmodules create mode 160000 db/groupdate create mode 100644 db/migrate/20220324131233_groupdate.rb diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..cd6939e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "db/groupdate"] + path = db/groupdate + url = https://github.com/ankane/groupdate.sql diff --git a/db/groupdate b/db/groupdate new file mode 160000 index 0000000..e8eaa5b --- /dev/null +++ b/db/groupdate @@ -0,0 +1 @@ +Subproject commit e8eaa5b42d9e0ccd1628240a8b86ceb975ed4205 diff --git a/db/migrate/20220324131233_groupdate.rb b/db/migrate/20220324131233_groupdate.rb new file mode 100644 index 0000000..60c9c9b --- /dev/null +++ b/db/migrate/20220324131233_groupdate.rb @@ -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