has_moderated 0.0.2 → 0.0.3

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.
data/README.rdoc CHANGED
@@ -26,15 +26,22 @@ to your model.
26
26
 
27
27
  If you want to moderate the creation of a record (for example, you don't want new blog posts to show up until they are accepted by a moderator), use
28
28
 
29
- has_moderated_existance
29
+ has_moderated_create
30
30
 
31
31
  You can also specify associations that need to be saved for moderation as well (if moderating the creation of new records) - for example, if a Post has_many :links, and you want to submit these links to moderation as well (note, if you don't, they will be discarded), use
32
32
 
33
- has_moderated_existance :with_associations => [:links]
33
+ has_moderated_create :with_associations => [:links]
34
34
 
35
- in your Post model (post.rb). This only matters when you use has_moderated_existance.
35
+ in your Post model (post.rb). This only matters when you use has_moderated_create.
36
+ You can also use
36
37
 
37
- Right now it's not possible to moderate deletion (destruction) of records.
38
+ has_moderated_create :with_associations => :all
39
+
40
+ to include all associations, but I recommend you explicitly specify them if possible. By default, no associations are included.
41
+
42
+ To moderate destruction of records, use
43
+
44
+ has_moderated_destroy
38
45
 
39
46
  == Manage moderations
40
47
  To see pending moderations, simply call
@@ -70,6 +77,11 @@ You can run the tests by running
70
77
 
71
78
  in the root directory.
72
79
 
80
+ == Problems
81
+
82
+ You may encounter problems with models that have some sort of non-serializable attributes. This might be something like file attachments, you'll have to try it to see.
83
+ If you have a problem like that you can extract the problematic attributes into a seperate has_one association. If you moderate create, save that model without the foreign key first, and then use has_moderated_create :with_associations => [:association_name] and add the association (to the existing associated model) before saving the moderated model. If you have questions about this or don't understand what I mean, open an issue here at GitHub and I will explain it further.
84
+
73
85
  == License
74
86
 
75
87
  This project rocks and uses MIT-LICENSE.
@@ -1,3 +1,3 @@
1
1
  module HasModerated
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/has_moderated.rb CHANGED
@@ -26,8 +26,8 @@ module HasModerated
26
26
  # send moderated attributes to moderation before saving the model
27
27
  before_save do
28
28
  if self.valid? && @has_moderated_updating != true &&
29
- # don't save moderated attributes if existance is moderated and it's a new record
30
- !(self.class.respond_to?("moderated_existance_options") && new_record?)
29
+ # don't save moderated attributes if create is moderated and it's a new record
30
+ !(self.class.respond_to?("moderated_create_options") && new_record?)
31
31
  moderations = self.to_moderation
32
32
  if self.id.blank?
33
33
  @pending_moderations ||= []
@@ -47,7 +47,7 @@ module HasModerated
47
47
  end
48
48
  end
49
49
 
50
- def has_moderated_existance options
50
+ def has_moderated_create *options
51
51
  # Lazily include the instance methods so we don't clutter up
52
52
  # any more ActiveRecord models than we have to.
53
53
  send :include, InstanceMethods
@@ -56,30 +56,65 @@ module HasModerated
56
56
  attr_accessor :has_moderated_updating
57
57
 
58
58
  # save options for use later
59
- cattr_accessor :moderated_existance_options
60
- self.moderated_existance_options = options
59
+ cattr_accessor :moderated_create_options
60
+ self.moderated_create_options = (options.count > 0) ? options[0] : nil
61
61
 
62
62
  alias_method_chain :create_or_update, :moderated_check
63
63
  end
64
+
65
+ def has_moderated_destroy *options
66
+ # Lazily include the instance methods so we don't clutter up
67
+ # any more ActiveRecord models than we have to.
68
+ send :include, InstanceMethods
69
+
70
+ # use an attribute to temporarily disable moderation before_save filter
71
+ attr_accessor :has_moderated_updating
72
+
73
+ alias_method_chain :destroy, :moderated_check
74
+ end
64
75
  end
65
76
 
66
77
  module InstanceMethods
67
78
  def create_or_update_with_moderated_check *args
68
79
  if valid? && new_record? && @has_moderated_updating != true
69
- self.to_moderation_created(self.class.moderated_existance_options)
80
+ self.to_moderation_created(self.class.moderated_create_options)
70
81
  true
71
82
  else
72
83
  create_or_update_without_moderated_check *args
73
84
  end
74
85
  end
86
+
87
+ def destroy_with_moderated_check *args
88
+ if @has_moderated_updating == true
89
+ destroy_without_moderated_check *args
90
+ else
91
+ to_moderation_destroyed
92
+ true
93
+ end
94
+ end
95
+
96
+ def to_moderation_destroyed
97
+ Moderation.create!({
98
+ :moderatable_type => self.class.to_s,
99
+ :moderatable_id => self.id,
100
+ :attr_name => "-",
101
+ :attr_value => "destroy"
102
+ })
103
+ end
75
104
 
76
105
  def to_moderation_created options
77
106
  assocs = []
78
107
 
79
108
  unless options.blank?
80
109
  unless options[:with_associations].blank?
81
- assocs = options[:with_associations]
82
- assocs = [assocs] unless assocs.respond_to?("[]")
110
+ if options[:with_associations] == :all
111
+ assocs = self.class.reflections.keys.reject do |r|
112
+ r == :moderations
113
+ end
114
+ else
115
+ assocs = options[:with_associations]
116
+ assocs = [assocs] unless assocs.respond_to?("[]")
117
+ end
83
118
  end
84
119
  end
85
120
 
@@ -87,7 +122,11 @@ module HasModerated
87
122
  assocs.each do |assoc|
88
123
  one_assoc = []
89
124
  self.send(assoc).each do |m|
90
- one_assoc.push(m.attributes)
125
+ if m.new_record?
126
+ one_assoc.push(m.attributes)
127
+ else
128
+ one_assoc.push(m.id)
129
+ end
91
130
  end
92
131
  assoc_attrs[assoc] = one_assoc unless one_assoc.empty?
93
132
  end
@@ -2,8 +2,14 @@ class Moderation < ActiveRecord::Base
2
2
  belongs_to :moderatable, :polymorphic => true
3
3
 
4
4
  def accept
5
+ # case: moderated destruction
6
+ if attr_name == '-' && attr_value.class == String && attr_value == "destroy"
7
+ moderatable.has_moderated_updating = true
8
+ moderatable.destroy
9
+ moderatable.has_moderated_updating = false
10
+ self.destroy
5
11
  # case: moderated existance (new record)
6
- if attr_name == '-'
12
+ elsif attr_name == '-'
7
13
  # create the main record
8
14
  rec = moderatable_type.constantize.new
9
15
  loaded_val = YAML::load(attr_value)
@@ -25,20 +31,25 @@ class Moderation < ActiveRecord::Base
25
31
 
26
32
  # all records for this associated model
27
33
  assoc_records.each do |attrs|
28
- arec = m.new # new associated model
29
- attrs.each_pair do |key, val|
30
- arec.send(key.to_s+"=", val) unless key.to_s == 'id'
31
- end
32
- fk = if assoc_details.respond_to?(:foreign_key)
33
- assoc_details.foreign_key
34
- else # version < 3.1
35
- assoc_details.primary_key_name
34
+ if attrs.class == Fixnum # associate to existing record
35
+ arec = m.find_by_id(attrs)
36
+ rec.send(assoc_name.to_s) << arec if arec # add the association, if the record still exists
37
+ else # create a new record
38
+ arec = m.new # new associated model
39
+ attrs.each_pair do |key, val|
40
+ arec.send(key.to_s+"=", val) unless key.to_s == 'id'
41
+ end
42
+ fk = if assoc_details.respond_to?(:foreign_key)
43
+ assoc_details.foreign_key
44
+ else # version < 3.1
45
+ assoc_details.primary_key_name
46
+ end
47
+ arec.send(fk.to_s+"=", rec.id) # set association to the newly created record
48
+ # disable moderation for associated model (if enabled)
49
+ arec.has_moderated_updating = true if arec.respond_to?("has_moderated_updating=")
50
+ arec.save
51
+ arec.has_moderated_updating = false if arec.respond_to?("has_moderated_updating=")
36
52
  end
37
- arec.send(fk.to_s+"=", rec.id) # set association to the newly created record
38
- # disable moderation for associated model (if enabled)
39
- arec.has_moderated_updating = true if arec.respond_to?("has_moderated_updating=")
40
- arec.save
41
- arec.has_moderated_updating = false if arec.respond_to?("has_moderated_updating=")
42
53
  end
43
54
  end
44
55
  self.destroy # destroy this moderation since it has been applied
@@ -2,5 +2,6 @@ class Task < ActiveRecord::Base
2
2
  attr_accessible :title
3
3
  has_many :subtasks
4
4
  has_moderated :title, :desc
5
- has_moderated_existance :with_associations => [:subtasks]
5
+ has_moderated_create :with_associations => [:subtasks]
6
+ has_moderated_destroy
6
7
  end
@@ -0,0 +1,4 @@
1
+ class TaskAll < ActiveRecord::Base
2
+ has_moderated_create :with_associations => :all
3
+ has_many :subtasks
4
+ end
Binary file
@@ -0,0 +1,10 @@
1
+ class CreateTaskAlls < ActiveRecord::Migration
2
+ def change
3
+ create_table :task_alls do |t|
4
+ t.string :title
5
+ t.string :value
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class AddTaskAllIdToSubtasks < ActiveRecord::Migration
2
+ def change
3
+ add_column :subtasks, :task_all_id, :integer
4
+ end
5
+ end
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended to check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(:version => 20110901013618) do
13
+ ActiveRecord::Schema.define(:version => 20110908025606) do
14
14
 
15
15
  create_table "moderations", :force => true do |t|
16
16
  t.integer "moderatable_id"
@@ -27,6 +27,14 @@ ActiveRecord::Schema.define(:version => 20110901013618) do
27
27
  t.string "desc"
28
28
  t.datetime "created_at"
29
29
  t.datetime "updated_at"
30
+ t.integer "task_all_id"
31
+ end
32
+
33
+ create_table "task_alls", :force => true do |t|
34
+ t.string "title"
35
+ t.string "value"
36
+ t.datetime "created_at"
37
+ t.datetime "updated_at"
30
38
  end
31
39
 
32
40
  create_table "tasks", :force => true do |t|
Binary file
@@ -420,3 +420,209 @@ Migrating to CreateModerations (20110901013618)
420
420
   (71.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
421
421
   (66.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
422
422
   (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
423
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
424
+  (0.1ms) select sqlite_version(*)
425
+  (89.3ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
426
+  (67.8ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
427
+  (78.5ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
428
+  (58.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
429
+  (0.1ms) PRAGMA index_list("schema_migrations")
430
+  (74.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
431
+  (0.2ms) SELECT version FROM "schema_migrations"
432
+  (72.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
433
+  (49.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
434
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
435
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
436
+  (0.1ms) select sqlite_version(*)
437
+  (98.4ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
438
+  (71.1ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
439
+  (76.1ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
440
+  (69.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
441
+  (0.1ms) PRAGMA index_list("schema_migrations")
442
+  (79.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
443
+  (0.2ms) SELECT version FROM "schema_migrations"
444
+  (58.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
445
+  (57.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
446
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
447
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
448
+  (0.1ms) select sqlite_version(*)
449
+  (96.9ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
450
+  (54.5ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
451
+  (84.3ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
452
+  (69.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
453
+  (0.1ms) PRAGMA index_list("schema_migrations")
454
+  (79.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
455
+  (0.2ms) SELECT version FROM "schema_migrations"
456
+  (58.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
457
+  (57.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
458
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
459
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
460
+  (0.1ms) select sqlite_version(*)
461
+  (96.9ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
462
+  (51.0ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
463
+  (80.5ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
464
+  (58.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
465
+  (0.1ms) PRAGMA index_list("schema_migrations")
466
+  (75.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
467
+  (0.2ms) SELECT version FROM "schema_migrations"
468
+  (63.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
469
+  (57.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
470
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
471
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
472
+  (0.1ms) select sqlite_version(*)
473
+  (92.3ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
474
+  (65.2ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
475
+  (82.8ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
476
+  (54.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
477
+  (0.1ms) PRAGMA index_list("schema_migrations")
478
+  (78.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
479
+  (0.2ms) SELECT version FROM "schema_migrations"
480
+  (59.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
481
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
482
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
483
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
484
+  (0.1ms) select sqlite_version(*)
485
+  (104.7ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
486
+  (52.8ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
487
+  (76.0ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
488
+  (52.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
489
+  (0.1ms) PRAGMA index_list("schema_migrations")
490
+  (80.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
491
+  (0.2ms) SELECT version FROM "schema_migrations"
492
+  (57.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
493
+  (66.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
494
+  (66.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
495
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
496
+  (0.1ms) select sqlite_version(*)
497
+  (97.1ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
498
+  (82.4ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
499
+  (73.2ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
500
+  (55.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
501
+  (0.1ms) PRAGMA index_list("schema_migrations")
502
+  (77.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
503
+  (0.2ms) SELECT version FROM "schema_migrations"
504
+  (61.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
505
+  (58.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
506
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
507
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
508
+  (0.1ms) select sqlite_version(*)
509
+  (98.8ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
510
+  (53.6ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
511
+  (77.1ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
512
+  (51.7ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
513
+  (0.1ms) PRAGMA index_list("schema_migrations")
514
+  (74.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
515
+  (0.2ms) SELECT version FROM "schema_migrations"
516
+  (55.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
517
+  (66.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
518
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
519
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
520
+  (0.1ms) select sqlite_version(*)
521
+  (94.8ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
522
+  (54.2ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
523
+  (74.6ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
524
+  (54.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
525
+  (0.1ms) PRAGMA index_list("schema_migrations")
526
+  (86.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
527
+  (0.3ms) SELECT version FROM "schema_migrations"
528
+  (51.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
529
+  (66.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
530
+  (66.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
531
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
532
+  (0.1ms) select sqlite_version(*)
533
+  (106.2ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
534
+  (51.0ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
535
+  (86.2ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
536
+  (59.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
537
+  (0.1ms) PRAGMA index_list("schema_migrations")
538
+  (81.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
539
+  (0.2ms) SELECT version FROM "schema_migrations"
540
+  (56.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
541
+  (57.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
542
+  (66.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
543
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
544
+  (0.1ms) select sqlite_version(*)
545
+  (95.8ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
546
+  (56.4ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
547
+  (82.9ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
548
+  (62.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
549
+  (0.1ms) PRAGMA index_list("schema_migrations")
550
+  (78.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
551
+  (0.2ms) SELECT version FROM "schema_migrations"
552
+  (51.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
553
+  (57.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
554
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
555
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
556
+  (0.1ms) select sqlite_version(*)
557
+  (105.7ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
558
+  (60.7ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
559
+  (86.3ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) 
560
+  (59.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
561
+  (0.1ms) PRAGMA index_list("schema_migrations")
562
+  (81.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
563
+  (0.2ms) SELECT version FROM "schema_migrations"
564
+  (56.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
565
+  (49.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
566
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
567
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
568
+ Migrating to CreateTasks (20110901013205)
569
+ Migrating to CreateSubtasks (20110901013228)
570
+ Migrating to CreateModerations (20110901013618)
571
+ Migrating to CreateTaskAlls (20110908025410)
572
+  (0.1ms) select sqlite_version(*)
573
+  (0.6ms) CREATE TABLE "task_alls" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "value" varchar(255), "created_at" datetime, "updated_at" datetime) 
574
+  (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ('20110908025410')
575
+ Migrating to AddTaskAllIdToSubtasks (20110908025606)
576
+  (0.5ms) ALTER TABLE "subtasks" ADD "task_all_id" integer
577
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20110908025606')
578
+  (0.2ms) select sqlite_version(*)
579
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
580
+  (0.1ms) PRAGMA index_list("moderations")
581
+  (0.1ms) PRAGMA index_list("subtasks")
582
+  (0.1ms) PRAGMA index_list("task_alls")
583
+  (0.1ms) PRAGMA index_list("tasks")
584
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
585
+  (0.1ms) select sqlite_version(*)
586
+  (92.7ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
587
+  (56.2ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime, "task_all_id" integer)
588
+  (83.7ms) CREATE TABLE "task_alls" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "value" varchar(255), "created_at" datetime, "updated_at" datetime) 
589
+  (53.4ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
590
+  (85.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
591
+  (0.1ms) PRAGMA index_list("schema_migrations")
592
+  (61.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
593
+  (0.2ms) SELECT version FROM "schema_migrations"
594
+  (55.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20110908025606')
595
+  (57.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20110908025410')
596
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
597
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
598
+  (49.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
599
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
600
+  (0.1ms) select sqlite_version(*)
601
+  (114.7ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
602
+  (58.8ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime, "task_all_id" integer)
603
+  (72.7ms) CREATE TABLE "task_alls" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "value" varchar(255), "created_at" datetime, "updated_at" datetime) 
604
+  (54.6ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
605
+  (84.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
606
+  (0.1ms) PRAGMA index_list("schema_migrations")
607
+  (63.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
608
+  (0.2ms) SELECT version FROM "schema_migrations"
609
+  (55.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20110908025606')
610
+  (57.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20110908025410')
611
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
612
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
613
+  (57.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
614
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
615
+  (0.1ms) select sqlite_version(*)
616
+  (95.8ms) CREATE TABLE "moderations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "moderatable_id" integer, "moderatable_type" varchar(255) NOT NULL, "attr_name" varchar(60) NOT NULL, "attr_value" text NOT NULL, "created_at" datetime, "updated_at" datetime) 
617
+  (58.2ms) CREATE TABLE "subtasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "task_id" integer, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime, "task_all_id" integer)
618
+  (72.3ms) CREATE TABLE "task_alls" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "value" varchar(255), "created_at" datetime, "updated_at" datetime) 
619
+  (55.0ms) CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
620
+  (83.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
621
+  (0.1ms) PRAGMA index_list("schema_migrations")
622
+  (63.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
623
+  (0.2ms) SELECT version FROM "schema_migrations"
624
+  (55.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20110908025606')
625
+  (57.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20110908025410')
626
+  (82.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013228')
627
+  (74.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
628
+  (82.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')