has_moderated 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +16 -4
- data/lib/has_moderated/version.rb +1 -1
- data/lib/has_moderated.rb +48 -9
- data/test/dummy/app/models/moderation.rb +25 -14
- data/test/dummy/app/models/task.rb +2 -1
- data/test/dummy/app/models/task_all.rb +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20110908025410_create_task_alls.rb +10 -0
- data/test/dummy/db/migrate/20110908025606_add_task_all_id_to_subtasks.rb +5 -0
- data/test/dummy/db/schema.rb +9 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +206 -0
- data/test/dummy/log/test.log +2703 -0
- data/test/dummy/spec/factories/task_alls.rb +8 -0
- data/test/dummy/spec/models/task_spec.rb +64 -0
- metadata +12 -4
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
|
-
|
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
|
-
|
33
|
+
has_moderated_create :with_associations => [:links]
|
34
34
|
|
35
|
-
in your Post model (post.rb). This only matters when you use
|
35
|
+
in your Post model (post.rb). This only matters when you use has_moderated_create.
|
36
|
+
You can also use
|
36
37
|
|
37
|
-
|
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.
|
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
|
30
|
-
!(self.class.respond_to?("
|
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
|
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 :
|
60
|
-
self.
|
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.
|
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
|
-
|
82
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
Binary file
|
data/test/dummy/db/schema.rb
CHANGED
@@ -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 =>
|
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|
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -420,3 +420,209 @@ Migrating to CreateModerations (20110901013618)
|
|
420
420
|
[1m[35m (71.3ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
421
421
|
[1m[36m (66.1ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
422
422
|
[1m[35m (57.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
423
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
424
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
425
|
+
[1m[36m (89.3ms)[0m [1mCREATE 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) [0m
|
426
|
+
[1m[35m (67.8ms)[0m 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
|
+
[1m[36m (78.5ms)[0m [1mCREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
428
|
+
[1m[35m (58.5ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
429
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
430
|
+
[1m[35m (74.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
431
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
432
|
+
[1m[35m (72.4ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
433
|
+
[1m[36m (49.5ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
434
|
+
[1m[35m (57.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
435
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
436
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
437
|
+
[1m[36m (98.4ms)[0m [1mCREATE 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) [0m
|
438
|
+
[1m[35m (71.1ms)[0m 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
|
+
[1m[36m (76.1ms)[0m [1mCREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
440
|
+
[1m[35m (69.4ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
441
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
442
|
+
[1m[35m (79.7ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
443
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
444
|
+
[1m[35m (58.6ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
445
|
+
[1m[36m (57.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
446
|
+
[1m[35m (57.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
447
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
448
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
449
|
+
[1m[36m (96.9ms)[0m [1mCREATE 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) [0m
|
450
|
+
[1m[35m (54.5ms)[0m 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
|
+
[1m[36m (84.3ms)[0m [1mCREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
452
|
+
[1m[35m (69.5ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
453
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
454
|
+
[1m[35m (79.5ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
455
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
456
|
+
[1m[35m (58.7ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
457
|
+
[1m[36m (57.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
458
|
+
[1m[35m (57.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
459
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
460
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
461
|
+
[1m[36m (96.9ms)[0m [1mCREATE 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) [0m
|
462
|
+
[1m[35m (51.0ms)[0m 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
|
+
[1m[36m (80.5ms)[0m [1mCREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
464
|
+
[1m[35m (58.0ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
465
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
466
|
+
[1m[35m (75.3ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
467
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
468
|
+
[1m[35m (63.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
469
|
+
[1m[36m (57.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
470
|
+
[1m[35m (57.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
471
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
472
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
473
|
+
[1m[36m (92.3ms)[0m [1mCREATE 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) [0m
|
474
|
+
[1m[35m (65.2ms)[0m 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
|
+
[1m[36m (82.8ms)[0m [1mCREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
476
|
+
[1m[35m (54.3ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
477
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
478
|
+
[1m[35m (78.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
479
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
480
|
+
[1m[35m (59.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
481
|
+
[1m[36m (57.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
482
|
+
[1m[35m (57.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
483
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
484
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
485
|
+
[1m[36m (104.7ms)[0m [1mCREATE 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) [0m
|
486
|
+
[1m[35m (52.8ms)[0m 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
|
+
[1m[36m (76.0ms)[0m [1mCREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
488
|
+
[1m[35m (52.8ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
489
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
490
|
+
[1m[35m (80.8ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
491
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
492
|
+
[1m[35m (57.5ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
493
|
+
[1m[36m (66.1ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
494
|
+
[1m[35m (66.2ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
495
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
496
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
497
|
+
[1m[36m (97.1ms)[0m [1mCREATE 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) [0m
|
498
|
+
[1m[35m (82.4ms)[0m 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
|
+
[1m[36m (73.2ms)[0m [1mCREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
500
|
+
[1m[35m (55.5ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
501
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
502
|
+
[1m[35m (77.0ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
503
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
504
|
+
[1m[35m (61.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
505
|
+
[1m[36m (58.0ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
506
|
+
[1m[35m (57.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
507
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
508
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
509
|
+
[1m[36m (98.8ms)[0m [1mCREATE 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) [0m
|
510
|
+
[1m[35m (53.6ms)[0m 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
|
+
[1m[36m (77.1ms)[0m [1mCREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
512
|
+
[1m[35m (51.7ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
513
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
514
|
+
[1m[35m (74.9ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
515
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
516
|
+
[1m[35m (55.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
517
|
+
[1m[36m (66.1ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
518
|
+
[1m[35m (57.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
519
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
520
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
521
|
+
[1m[36m (94.8ms)[0m [1mCREATE 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) [0m
|
522
|
+
[1m[35m (54.2ms)[0m 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
|
+
[1m[36m (74.6ms)[0m [1mCREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
524
|
+
[1m[35m (54.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
525
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
526
|
+
[1m[35m (86.8ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
527
|
+
[1m[36m (0.3ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
528
|
+
[1m[35m (51.5ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
529
|
+
[1m[36m (66.1ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
530
|
+
[1m[35m (66.2ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
531
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
532
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
533
|
+
[1m[36m (106.2ms)[0m [1mCREATE 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) [0m
|
534
|
+
[1m[35m (51.0ms)[0m 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
|
+
[1m[36m (86.2ms)[0m [1mCREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
536
|
+
[1m[35m (59.2ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
537
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
538
|
+
[1m[35m (81.7ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
539
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
540
|
+
[1m[35m (56.6ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
541
|
+
[1m[36m (57.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
542
|
+
[1m[35m (66.2ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
543
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
544
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
545
|
+
[1m[36m (95.8ms)[0m [1mCREATE 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) [0m
|
546
|
+
[1m[35m (56.4ms)[0m 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
|
+
[1m[36m (82.9ms)[0m [1mCREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
548
|
+
[1m[35m (62.4ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
549
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
550
|
+
[1m[35m (78.6ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
551
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
552
|
+
[1m[35m (51.4ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
553
|
+
[1m[36m (57.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
554
|
+
[1m[35m (57.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
555
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
556
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
557
|
+
[1m[36m (105.7ms)[0m [1mCREATE 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) [0m
|
558
|
+
[1m[35m (60.7ms)[0m 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
|
+
[1m[36m (86.3ms)[0m [1mCREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
560
|
+
[1m[35m (59.0ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
561
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
562
|
+
[1m[35m (81.7ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
563
|
+
[1m[36m (0.2ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
564
|
+
[1m[35m (56.5ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013618')
|
565
|
+
[1m[36m (49.5ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
566
|
+
[1m[35m (57.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
567
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
568
|
+
Migrating to CreateTasks (20110901013205)
|
569
|
+
Migrating to CreateSubtasks (20110901013228)
|
570
|
+
Migrating to CreateModerations (20110901013618)
|
571
|
+
Migrating to CreateTaskAlls (20110908025410)
|
572
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
573
|
+
[1m[36m (0.6ms)[0m [1mCREATE TABLE "task_alls" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "value" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
574
|
+
[1m[35m (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20110908025410')
|
575
|
+
Migrating to AddTaskAllIdToSubtasks (20110908025606)
|
576
|
+
[1m[36m (0.5ms)[0m [1mALTER TABLE "subtasks" ADD "task_all_id" integer[0m
|
577
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20110908025606')
|
578
|
+
[1m[36m (0.2ms)[0m [1mselect sqlite_version(*)[0m
|
579
|
+
[1m[35m (0.2ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
580
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("moderations")[0m
|
581
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("subtasks")
|
582
|
+
[1m[36m (0.1ms)[0m [1mPRAGMA index_list("task_alls")[0m
|
583
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("tasks")
|
584
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
585
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
586
|
+
[1m[36m (92.7ms)[0m [1mCREATE 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) [0m
|
587
|
+
[1m[35m (56.2ms)[0m 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
|
+
[1m[36m (83.7ms)[0m [1mCREATE TABLE "task_alls" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "value" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
589
|
+
[1m[35m (53.4ms)[0m CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
|
590
|
+
[1m[36m (85.5ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
591
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("schema_migrations")
|
592
|
+
[1m[36m (61.9ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
593
|
+
[1m[35m (0.2ms)[0m SELECT version FROM "schema_migrations"
|
594
|
+
[1m[36m (55.7ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110908025606')[0m
|
595
|
+
[1m[35m (57.8ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110908025410')
|
596
|
+
[1m[36m (57.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
597
|
+
[1m[35m (57.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
598
|
+
[1m[36m (49.6ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013618')[0m
|
599
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
600
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
601
|
+
[1m[36m (114.7ms)[0m [1mCREATE 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) [0m
|
602
|
+
[1m[35m (58.8ms)[0m 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
|
+
[1m[36m (72.7ms)[0m [1mCREATE TABLE "task_alls" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "value" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
604
|
+
[1m[35m (54.6ms)[0m CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
|
605
|
+
[1m[36m (84.3ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
606
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("schema_migrations")
|
607
|
+
[1m[36m (63.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
608
|
+
[1m[35m (0.2ms)[0m SELECT version FROM "schema_migrations"
|
609
|
+
[1m[36m (55.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110908025606')[0m
|
610
|
+
[1m[35m (57.8ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110908025410')
|
611
|
+
[1m[36m (57.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
612
|
+
[1m[35m (57.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
613
|
+
[1m[36m (57.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013618')[0m
|
614
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
615
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
616
|
+
[1m[36m (95.8ms)[0m [1mCREATE 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) [0m
|
617
|
+
[1m[35m (58.2ms)[0m 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
|
+
[1m[36m (72.3ms)[0m [1mCREATE TABLE "task_alls" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "value" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
619
|
+
[1m[35m (55.0ms)[0m CREATE TABLE "tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "desc" varchar(255), "created_at" datetime, "updated_at" datetime)
|
620
|
+
[1m[36m (83.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
621
|
+
[1m[35m (0.1ms)[0m PRAGMA index_list("schema_migrations")
|
622
|
+
[1m[36m (63.5ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
623
|
+
[1m[35m (0.2ms)[0m SELECT version FROM "schema_migrations"
|
624
|
+
[1m[36m (55.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110908025606')[0m
|
625
|
+
[1m[35m (57.8ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110908025410')
|
626
|
+
[1m[36m (82.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013228')[0m
|
627
|
+
[1m[35m (74.6ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20110901013205')
|
628
|
+
[1m[36m (82.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20110901013618')[0m
|