-
Notifications
You must be signed in to change notification settings - Fork 4
Migrations generators fix #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,9 +15,9 @@ class PermissionGenerator < ActiveRecord::Generators::Base | |
|
|
||
| def copy_zuul_migration | ||
| if (behavior == :invoke && model_exists?) || (behavior == :revoke && migration_exists?(:permission, table_name)) | ||
| migration_template "permission_existing.rb", "db/migrate/add_zuul_permission_to_#{table_name}" | ||
| migration_template "permission_existing.rb", "db/migrate/add_zuul_permission_to_#{table_name}.rb" | ||
| else | ||
| migration_template "permission.rb", "db/migrate/zuul_permission_create_#{table_name}" | ||
| migration_template "permission.rb", "db/migrate/zuul_permission_create_#{table_name}.rb" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [100/80] |
||
| end | ||
| end | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,17 +17,17 @@ class PermissionRoleGenerator < ActiveRecord::Generators::Base | |
| def name | ||
| [permission_model, role_model].sort.map(&:to_s).map(&:camelize).map(&:singularize).join("") | ||
| end | ||
|
|
||
| def copy_permission_role_migration | ||
| attributes << Rails::Generators::GeneratedAttribute.new("#{permission_model.to_s.underscore.singularize}_id", :integer) | ||
| attributes << Rails::Generators::GeneratedAttribute.new("#{role_model.to_s.underscore.singularize}_id", :integer) | ||
| attributes << Rails::Generators::GeneratedAttribute.new("context_type", :string) | ||
| attributes << Rails::Generators::GeneratedAttribute.new("context_id", :integer) | ||
|
|
||
| if (behavior == :invoke && model_exists?) || (behavior == :revoke && migration_exists?(:permission_role, table_name)) | ||
| migration_template "permission_role_existing.rb", "db/migrate/add_zuul_permission_role_to_#{table_name}" | ||
| migration_template "permission_role_existing.rb", "db/migrate/add_zuul_permission_role_to_#{table_name}.rb" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [119/80] |
||
| else | ||
| migration_template "permission_role.rb", "db/migrate/zuul_permission_role_create_#{table_name}" | ||
| migration_template "permission_role.rb", "db/migrate/zuul_permission_role_create_#{table_name}.rb" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [110/80] |
||
| end | ||
| end | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,17 +17,17 @@ class PermissionSubjectGenerator < ActiveRecord::Generators::Base | |
| def name | ||
| [permission_model, subject_model].sort.map(&:to_s).map(&:camelize).map(&:singularize).join("") | ||
| end | ||
|
|
||
| def copy_permission_subject_migration | ||
| attributes << Rails::Generators::GeneratedAttribute.new("#{permission_model.to_s.underscore.singularize}_id", :integer) | ||
| attributes << Rails::Generators::GeneratedAttribute.new("#{subject_model.to_s.underscore.singularize}_id", :integer) | ||
| attributes << Rails::Generators::GeneratedAttribute.new("context_type", :string) | ||
| attributes << Rails::Generators::GeneratedAttribute.new("context_id", :integer) | ||
|
|
||
| if (behavior == :invoke && model_exists?) || (behavior == :revoke && migration_exists?(:permission_subject, table_name)) | ||
| migration_template "permission_subject_existing.rb", "db/migrate/add_zuul_permission_subject_to_#{table_name}" | ||
| migration_template "permission_subject_existing.rb", "db/migrate/add_zuul_permission_subject_to_#{table_name}.rb" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [125/80] |
||
| else | ||
| migration_template "permission_subject.rb", "db/migrate/zuul_permission_subject_create_#{table_name}" | ||
| migration_template "permission_subject.rb", "db/migrate/zuul_permission_subject_create_#{table_name}.rb" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [116/80] |
||
| end | ||
| end | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,12 +12,12 @@ class RoleGenerator < ActiveRecord::Generators::Base | |
|
|
||
| include ::Zuul::Generators::OrmHelpers | ||
| source_root File.expand_path("../templates", __FILE__) | ||
|
|
||
| def copy_role_migration | ||
| if (behavior == :invoke && model_exists?) || (behavior == :revoke && migration_exists?(:role, table_name)) | ||
| migration_template "role_existing.rb", "db/migrate/add_zuul_role_to_#{table_name}" | ||
| migration_template "role_existing.rb", "db/migrate/add_zuul_role_to_#{table_name}.rb" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [97/80] |
||
| else | ||
| migration_template "role.rb", "db/migrate/zuul_role_create_#{table_name}" | ||
| migration_template "role.rb", "db/migrate/zuul_role_create_#{table_name}.rb" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [88/80] |
||
| end | ||
| end | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,17 +17,17 @@ class RoleSubjectGenerator < ActiveRecord::Generators::Base | |
| def name | ||
| [role_model, subject_model].sort.map(&:to_s).map(&:camelize).map(&:singularize).join("") | ||
| end | ||
|
|
||
| def copy_role_subject_migration | ||
| attributes << Rails::Generators::GeneratedAttribute.new("#{role_model.to_s.underscore.singularize}_id", :integer) | ||
| attributes << Rails::Generators::GeneratedAttribute.new("#{subject_model.to_s.underscore.singularize}_id", :integer) | ||
| attributes << Rails::Generators::GeneratedAttribute.new("context_type", :string) | ||
| attributes << Rails::Generators::GeneratedAttribute.new("context_id", :integer) | ||
|
|
||
| if (behavior == :invoke && model_exists?) || (behavior == :revoke && migration_exists?(:role_subject, table_name)) | ||
| migration_template "role_subject_existing.rb", "db/migrate/add_zuul_role_subject_to_#{table_name}" | ||
| migration_template "role_subject_existing.rb", "db/migrate/add_zuul_role_subject_to_#{table_name}.rb" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [113/80] |
||
| else | ||
| migration_template "role_subject.rb", "db/migrate/zuul_role_subject_create_#{table_name}" | ||
| migration_template "role_subject.rb", "db/migrate/zuul_role_subject_create_#{table_name}.rb" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [104/80] |
||
| end | ||
| end | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [109/80]