diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-01-24 10:36:38 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-01-24 10:36:38 +0000 |
commit | 1445541f487fe22ec44b71607be3300319338d0a (patch) | |
tree | 5c9ed659c968f092317de6bab59a712e2584ca66 /lib/generators | |
parent | 4eb8432dedc8b521086cdf163ebe5d373396d39a (diff) | |
parent | b0a939a4d44077b4602176042ff4432b790561ad (diff) |
Merge branch 'release/0.16'0.16
Diffstat (limited to 'lib/generators')
-rw-r--r-- | lib/generators/acts_as_xapian/USAGE | 1 | ||||
-rw-r--r-- | lib/generators/acts_as_xapian/acts_as_xapian_generator.rb | 10 | ||||
-rw-r--r-- | lib/generators/acts_as_xapian/templates/migration.rb | 14 |
3 files changed, 25 insertions, 0 deletions
diff --git a/lib/generators/acts_as_xapian/USAGE b/lib/generators/acts_as_xapian/USAGE new file mode 100644 index 000000000..2d027c46f --- /dev/null +++ b/lib/generators/acts_as_xapian/USAGE @@ -0,0 +1 @@ +./script/generate acts_as_xapian diff --git a/lib/generators/acts_as_xapian/acts_as_xapian_generator.rb b/lib/generators/acts_as_xapian/acts_as_xapian_generator.rb new file mode 100644 index 000000000..434c02cb5 --- /dev/null +++ b/lib/generators/acts_as_xapian/acts_as_xapian_generator.rb @@ -0,0 +1,10 @@ +require 'rails/generators/active_record/migration' + +class ActsAsXapianGenerator < Rails::Generators::Base + include Rails::Generators::Migration + extend ActiveRecord::Generators::Migration + source_root File.expand_path("../templates", __FILE__) + def create_migration_file + migration_template "migration.rb", "db/migrate/add_acts_as_xapian_jobs.rb" + end +end diff --git a/lib/generators/acts_as_xapian/templates/migration.rb b/lib/generators/acts_as_xapian/templates/migration.rb new file mode 100644 index 000000000..84a9dd766 --- /dev/null +++ b/lib/generators/acts_as_xapian/templates/migration.rb @@ -0,0 +1,14 @@ +class CreateActsAsXapian < ActiveRecord::Migration + def self.up + create_table :acts_as_xapian_jobs do |t| + t.column :model, :string, :null => false + t.column :model_id, :integer, :null => false + t.column :action, :string, :null => false + end + add_index :acts_as_xapian_jobs, [:model, :model_id], :unique => true + end + def self.down + drop_table :acts_as_xapian_jobs + end +end + |