migration_queries 0.4.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -6
- data/Rakefile +0 -2
- data/lib/migration_queries/version.rb +1 -1
- data/lib/migration_queries.rb +3 -5
- metadata +1 -2
- data/lib/tasks/setup_migration_queries.rake +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d841a636d5ad72e9991f1f87ed98bb4a0a1b51098a674db5dae93f5d2f94ccaa
|
4
|
+
data.tar.gz: aa79169e44d9ce5adbbf1142d738d49b3aee19048f86baa82be747695b653c8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65e15bb1a441237afbc72d50a9206334dd7dafee4e0f4af3cbbbb949106e3e3e57088bada8464b781071177219ca366f1ffb1e34b3ef30675ce8117a09d59a27
|
7
|
+
data.tar.gz: b0cecb473508ad96399022335b6ff0e9decc6951f6f7f6b82f6bdd45a7acd70733a16358a8906f4279a93d8697ba8e9240bef4f0e77798a39d8845ac640ff29c
|
data/README.md
CHANGED
@@ -14,12 +14,6 @@ end
|
|
14
14
|
|
15
15
|
Then, run `bundle install` to install the gem.
|
16
16
|
|
17
|
-
And then execute:
|
18
|
-
|
19
|
-
```bash
|
20
|
-
bundle exec rake migration_queries:install
|
21
|
-
```
|
22
|
-
|
23
17
|
## Usage
|
24
18
|
|
25
19
|
The gem is going to automatically track migration queries executed by ActiveRecord. You can view the logged queries in your Rails console or in the log files.
|
data/Rakefile
CHANGED
data/lib/migration_queries.rb
CHANGED
@@ -6,6 +6,9 @@ require_relative "migration_queries/executer"
|
|
6
6
|
require_relative "migration_queries/migrater"
|
7
7
|
require "active_record"
|
8
8
|
|
9
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.include(MigrationQueries::Executer)
|
10
|
+
ActiveRecord::Migration::Current.include(MigrationQueries::Migrater)
|
11
|
+
|
9
12
|
# MigrationQueries is a module that provides functionality to gather, execute, and migrate SQL queries
|
10
13
|
# during ActiveRecord migrations. It includes the Gatherer, Executer, and Migrater modules to handle
|
11
14
|
# different aspects of SQL query management.
|
@@ -15,9 +18,4 @@ module MigrationQueries
|
|
15
18
|
def self.gatherer
|
16
19
|
@gatherer ||= MigrationQueries::Gatherer.new
|
17
20
|
end
|
18
|
-
|
19
|
-
def self.init!
|
20
|
-
ActiveRecord::ConnectionAdapters::AbstractAdapter.include(MigrationQueries::Executer)
|
21
|
-
ActiveRecord::Migration::Current.include(MigrationQueries::Migrater)
|
22
|
-
end
|
23
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: migration_queries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Szymon Lipka
|
@@ -46,7 +46,6 @@ files:
|
|
46
46
|
- lib/migration_queries/gatherer.rb
|
47
47
|
- lib/migration_queries/migrater.rb
|
48
48
|
- lib/migration_queries/version.rb
|
49
|
-
- lib/tasks/setup_migration_queries.rake
|
50
49
|
- sig/migration_queries.rbs
|
51
50
|
- sig/migration_queries/data.rbs
|
52
51
|
- sig/migration_queries/executer.rbs
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# lib/tasks/setup_migration_queries.rake
|
2
|
-
|
3
|
-
namespace :migration_queries do
|
4
|
-
desc "Create migration_queries.rb initializer"
|
5
|
-
task :setup do
|
6
|
-
initializer_path = Rails.root.join("config", "initializers", "migration_queries.rb")
|
7
|
-
content = <<~RUBY
|
8
|
-
# frozen_string_literal: true
|
9
|
-
|
10
|
-
if Rails.env.development?
|
11
|
-
require 'migration_queries'
|
12
|
-
|
13
|
-
MigrationQueries.init!
|
14
|
-
end
|
15
|
-
RUBY
|
16
|
-
|
17
|
-
if File.exist?(initializer_path)
|
18
|
-
puts "Initializer file already exists at #{initializer_path}"
|
19
|
-
else
|
20
|
-
File.write(initializer_path, content)
|
21
|
-
puts "Created initializer file at #{initializer_path}"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|