mirror of
https://github.com/discourse/discourse.git
synced 2024-12-24 10:06:28 +08:00
20 lines
604 B
Ruby
20 lines
604 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
require "rails/generators/active_record/migration/migration_generator"
|
||
|
|
||
|
class Rails::PluginMigrationGenerator < ActiveRecord::Generators::MigrationGenerator
|
||
|
class_option :plugin_name,
|
||
|
type: :string,
|
||
|
banner: "plugin_name",
|
||
|
desc: "The plugin name to generate the migration into.",
|
||
|
required: true
|
||
|
|
||
|
source_root "#{Gem.loaded_specs["activerecord"].full_gem_path}/lib/rails/generators/active_record/migration/templates"
|
||
|
|
||
|
private
|
||
|
|
||
|
def db_migrate_path
|
||
|
"plugins/#{options["plugin_name"]}/db/migrate"
|
||
|
end
|
||
|
end
|