migration_queries 0.3.0 → 0.4.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 +29 -11
- data/lib/migration_queries/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ff997e1ebe254c3fd23a538365fa0cafbcfc010c3e5199054202ed6bd1b2851
|
4
|
+
data.tar.gz: 70bef9fc0517130bc9158cc1f48c32b38c098ab9f93248de3957da1ea52ae87a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55526a659e9ea130374069cc062a9895ffe8734845f91490514a64ad24ae11b3b574c7ccdc2011364585a2d63ec4037596a3d31c33e5e6724036714695b59f6a
|
7
|
+
data.tar.gz: f80f52f70194dd955c697d931ac42cc6c08b85cdd67e2ffb717ec5c1dc1b307e1d5b40f383117774c769a2630aec96777ac6cb75076fdf0db16dec7a8ee244ab
|
data/README.md
CHANGED
@@ -1,28 +1,46 @@
|
|
1
1
|
# MigrationQueries
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/migration_queries`. To experiment with that code, run `bin/console` for an interactive prompt.
|
3
|
+
The `migration_queries` gem improves tracking of migration queries in Ruby on Rails applications. It provides a simple way to log and analyze the SQL queries generated by ActiveRecord migrations, helping developers optimize their database interactions.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
Install the gem and add to the application's Gemfile by executing:
|
7
|
+
Add this gem to development dependencies in your `Gemfile`:
|
12
8
|
|
13
|
-
```
|
14
|
-
|
9
|
+
```ruby
|
10
|
+
group :development do
|
11
|
+
gem 'migration_queries'
|
12
|
+
end
|
15
13
|
```
|
16
14
|
|
17
|
-
|
15
|
+
Then, run `bundle install` to install the gem.
|
16
|
+
|
17
|
+
And then execute:
|
18
18
|
|
19
19
|
```bash
|
20
|
-
|
20
|
+
bundle exec rake migration_queries:install
|
21
21
|
```
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
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.
|
26
|
+
|
27
|
+
Example migration file after running migration and logging queries:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
class AddExampleTable < ActiveRecord::Migration[6.0]
|
31
|
+
def change
|
32
|
+
create_table :example do |t|
|
33
|
+
t.string :name
|
34
|
+
t.timestamps
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
=begin Migration Queries
|
39
|
+
CREATE TABLE "example" ("id" bigserial primary key, "name" character varying, "created_at" timestamp(6) NOT NULL, "updated_at" timestamp(6) NOT NULL)
|
40
|
+
|
41
|
+
# Migration Queries written on 2025-07-04 12:36:54 +0200
|
42
|
+
=end
|
43
|
+
```
|
26
44
|
|
27
45
|
## Development
|
28
46
|
|