File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
lib/generators/queue_classic Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+ require 'active_record'
4
+
5
+ module QC
6
+ class InstallGenerator < Rails ::Generators ::Base
7
+ include Rails ::Generators ::Migration
8
+
9
+ namespace "queue_classic:install"
10
+ self . source_paths << File . join ( File . dirname ( __FILE__ ) , 'templates' )
11
+ desc 'Generates (but does not run) a migration to add a queue_classic table.'
12
+
13
+ def self . next_migration_number ( dirname )
14
+ next_migration_number = current_migration_number ( dirname ) + 1
15
+ ActiveRecord ::Migration . next_migration_number ( next_migration_number )
16
+ end
17
+
18
+ def create_migration_file
19
+ migration_template 'add_queue_classic.rb' , 'db/migrate/add_queue_classic.rb'
20
+ end
21
+ end
22
+ end
Original file line number Diff line number Diff line change
1
+ class AddQueueClassic < ActiveRecord ::Migration
2
+ def self . up
3
+ QC ::Setup . create
4
+ end
5
+
6
+ def self . down
7
+ QC ::Setup . drop
8
+ end
9
+ end
You can’t perform that action at this time.
0 commit comments