ff1 1.2.5 → 1.2.7
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/lib/ff1/version.rb +1 -1
- data/lib/generators/ff1/install_generator.rb +4 -14
- data/lib/generators/ff1/templates/migration.rb.erb +3 -7
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71afb6323a419b0916d942aebde5f19bfa5396dbf44ffa631eff6a942b686ca2
|
4
|
+
data.tar.gz: ff57e228e1e2a16ba28384102cdbc7a14fc46c4089d8b4aea2e6226739e15b50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a576582e6f503dd1b81baac07f4a095b70a3eddaa1547e352118e2f8814734e3d10071a758bb14d6a9c5ad1256f7cff2faa03d63f73479c8288ddf1c8dd3f839
|
7
|
+
data.tar.gz: 54d9e13bd33917747bab54644cc5f8ce6669c2a5f8f257125c45436baf1ca998671fe2f0c99ec8daf5ef6c7b8c3e7e4e242377b535d2995d5cfddd0433bce120
|
data/lib/ff1/version.rb
CHANGED
@@ -21,8 +21,6 @@ module Ff1
|
|
21
21
|
class_option :deleted_at_column, type: :string, default: 'deleted_at',
|
22
22
|
desc: 'Name of the deleted_at timestamp column'
|
23
23
|
|
24
|
-
class_option :ff1_deleted_column, type: :string, default: 'ff1_deleted',
|
25
|
-
desc: 'Name of the FF1 deleted boolean column'
|
26
24
|
|
27
25
|
class_option :add_indexes, type: :boolean, default: true,
|
28
26
|
desc: 'Add database indexes for performance'
|
@@ -57,9 +55,9 @@ module Ff1
|
|
57
55
|
|
58
56
|
def generate_model_migration(model_name)
|
59
57
|
model_class_name = model_name.camelize
|
60
|
-
table_name = model_name.underscore.pluralize
|
61
|
-
migration_name = "add_ff1_columns_to_#{table_name}"
|
62
|
-
migration_class_name = "AddFf1ColumnsTo#{model_class_name.pluralize}"
|
58
|
+
@table_name = model_name.underscore.pluralize
|
59
|
+
migration_name = "add_ff1_columns_to_#{@table_name}"
|
60
|
+
@migration_class_name = "AddFf1ColumnsTo#{model_class_name.pluralize}"
|
63
61
|
|
64
62
|
# Check if model exists
|
65
63
|
begin
|
@@ -70,12 +68,7 @@ module Ff1
|
|
70
68
|
|
71
69
|
# Generate migration file
|
72
70
|
migration_template 'migration.rb.erb',
|
73
|
-
"db/migrate/#{timestamp}_#{migration_name}.rb"
|
74
|
-
migration_class: migration_class_name,
|
75
|
-
table_name: table_name,
|
76
|
-
deleted_at_column: deleted_at_column,
|
77
|
-
ff1_deleted_column: ff1_deleted_column,
|
78
|
-
add_indexes: add_indexes?
|
71
|
+
"db/migrate/#{timestamp}_#{migration_name}.rb"
|
79
72
|
|
80
73
|
say "Migration created for #{model_class_name}", :green
|
81
74
|
say "Run 'rails db:migrate' to apply the changes", :blue
|
@@ -89,9 +82,6 @@ module Ff1
|
|
89
82
|
options['deleted_at_column']
|
90
83
|
end
|
91
84
|
|
92
|
-
def ff1_deleted_column
|
93
|
-
options['ff1_deleted_column']
|
94
|
-
end
|
95
85
|
|
96
86
|
def add_indexes?
|
97
87
|
options['add_indexes']
|
@@ -1,15 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
3
|
+
class <%= @migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
4
4
|
def change
|
5
|
-
add_column :<%= table_name %>, :<%= deleted_at_column %>, :datetime, null: true
|
6
|
-
add_column :<%= table_name %>, :<%= ff1_deleted_column %>, :boolean, null: false, default: false
|
5
|
+
add_column :<%= @table_name %>, :<%= deleted_at_column %>, :datetime, null: true
|
7
6
|
|
8
7
|
<% if add_indexes? %>
|
9
|
-
add_index :<%= table_name %>, :<%= deleted_at_column %>
|
10
|
-
add_index :<%= table_name %>, :<%= ff1_deleted_column %>
|
11
|
-
add_index :<%= table_name %>, [:<%= ff1_deleted_column %>, :<%= deleted_at_column %>],
|
12
|
-
name: 'index_<%= table_name %>_on_ff1_deletion'
|
8
|
+
add_index :<%= @table_name %>, :<%= deleted_at_column %>
|
13
9
|
<% end %>
|
14
10
|
end
|
15
11
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ff1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ahmed Abdellatif
|
@@ -129,15 +129,15 @@ files:
|
|
129
129
|
- spec/ff1_spec.rb
|
130
130
|
- spec/generators/ff1/install_generator_spec.rb
|
131
131
|
- spec/spec_helper.rb
|
132
|
-
homepage: https://github.com/a-abdellatif98/
|
132
|
+
homepage: https://github.com/a-abdellatif98/ff1_gem
|
133
133
|
licenses:
|
134
134
|
- MIT
|
135
135
|
metadata:
|
136
|
-
bug_tracker_uri: https://github.com/a-abdellatif98/
|
137
|
-
changelog_uri: https://github.com/a-abdellatif98/ff1/
|
138
|
-
documentation_uri: https://github.com/a-abdellatif98/
|
139
|
-
homepage_uri: https://github.com/a-abdellatif98/
|
140
|
-
source_code_uri: https://github.com/a-abdellatif98/
|
136
|
+
bug_tracker_uri: https://github.com/a-abdellatif98/ff1_gem/issues
|
137
|
+
changelog_uri: https://github.com/a-abdellatif98/ff1/ff1_gem/main/CHANGELOG.md
|
138
|
+
documentation_uri: https://github.com/a-abdellatif98/ff1_gem/blob/main/README.md
|
139
|
+
homepage_uri: https://github.com/a-abdellatif98/ff1_gem
|
140
|
+
source_code_uri: https://github.com/a-abdellatif98/ff1_gem
|
141
141
|
post_install_message:
|
142
142
|
rdoc_options: []
|
143
143
|
require_paths:
|