file_manager_engine 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,7 +15,11 @@ capybara-*.html
15
15
  rerun.txt
16
16
  pickle-email-*.html
17
17
  pkg/
18
- test/dummy/db/*.sqlite3
19
- test/dummy/log/*.log
20
- test/dummy/tmp/
21
- test/dummy/.sass-cache
18
+ spec/dummy/db/*.sqlite3
19
+ spec/dummy/db/schema.rb
20
+ spec/dummy/log/*.log
21
+ spec/dummy/tmp/
22
+ spec/dummy/.sass-cache
23
+ Gemfile.lock
24
+ .rvmrc
25
+ .idea/
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2012 YOURNAME
1
+ Copyright 2012 G. Gutiérrez & J. Vázquez
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,27 +1,53 @@
1
- FileManagerEngine
2
- =================
1
+ # FileManagerEngine
3
2
 
4
- Rails 3 engine to track used files elsewhere your models
3
+ Rails 3 engine to track used files elsewhere in your models.
5
4
 
6
- Install
7
- =================
5
+ Have you ever deleted a file without knowing if it was being used? Are they broken links to images?
6
+ Were they removed regardless of where they were used?
8
7
 
9
- Use
10
- =================
8
+ With FileManagerEngine you can keep track of all the files used in your application and you will see where they
9
+ are being used before deleting them and not make mistakes corrupt leaving your links or wrong your posts.
11
10
 
11
+ # Getting Started
12
+
13
+ ## Install
14
+
15
+ Add this line to your Gemfile:
16
+
17
+ gem file_manager_engine
18
+
19
+ And execute <code>bundle install</code>
20
+
21
+ ## Models
22
+
12
23
  You need add this lines to used FileManager in your app:
13
24
 
14
- <pre><code>
15
- include 'FileManagerEngine"
16
- self.file\_field\_name = [name field]
17
- </code></pre>
25
+ include 'FileManagerEngine"
26
+ self.file_field_name = [name field]
18
27
 
19
- name_field is refered to name the field or scope how you used to relationated the entity with the file or files included in the instance to save.
28
+ name_field is refered to name the field or scope how you used to relationated the entity with the file or files
29
+ included in the instance to save.
20
30
 
21
31
  Examples:
22
32
 
23
- If a new post used a file image called "foto.jpg" and Post entity has a field called "image\_id" to refered with this image file, then you self.file\_field\_name = :image\_id
33
+ If a new post used a file image called "foto.jpg" and Post entity has a field called "image\_id" to refered with this
34
+ image file, then you self.file\_field\_name = :image\_id
35
+
36
+ Other case, if you don't have a entity to admin files, and you insert a files by their path and the post entity has a
37
+ field called "path" you self.file\_field\_name = :path.
38
+
39
+ In conclusion, this params is used to search the file when you need to delete it and search the relation with the rest
40
+ of entities in your model.
41
+
42
+ ## Using in View
43
+
44
+ When you go to remove some file in your app interface (for example, administrator), you should use this command in the
45
+ remove's process:
46
+
47
+ FileManager.used_in([file])
24
48
 
25
- Other case, if you don't have a entity to admin files, and you insert a files by their path and the post entity has a field called "path" you self.file\_field\_name = :path.
49
+ Where file is the value which It's returned by <code>self.file\_field\_name</code> in the entities which used
50
+ FileManager gem.
26
51
 
27
- In conclusion, this params is used to search the file when you need to delete it and search the relation with the rest of entities in your model.
52
+ # LICENSE
53
+ [MIT License]. Copyright 2012 G. Gutiérrez & J. Vázquez.
@@ -1,22 +1,21 @@
1
- # File Manager Model
1
+ # File Manager Model
2
2
  #
3
- # @author xiterrex & jnillo
4
- # @description This module represent instances between files references in other objects of data models.
5
- # For example, a post that used a image in his content.
3
+ # @author xiterrex & jnillo
4
+ # @description This module represent instances between files references in other objects of data models.
5
+ # For example, a post that used a image in his content.
6
6
  class FileManager < ActiveRecord::Base
7
-
7
+
8
8
  attr_accessible :entity_id, :entity_type, :file
9
9
 
10
10
  # Polimorfic relation between this entity and the entities how used files
11
11
  belongs_to :entity, :polymorphic => true
12
12
 
13
-
14
-
15
13
  # Used In static method
16
14
  #
17
15
  # @param [String] file reference
18
- # @return [List] List of instances of models entities which use this file (Instances entities list)
16
+ # @return: [List] List of instances of models entities which use this file (Instances entities list)
19
17
  def self.used_in(file)
20
18
  FileManager.find_all_by_file(file).map(&:entity)
21
19
  end
20
+
22
21
  end
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.add_development_dependency "rspec-rails"
23
23
  s.add_development_dependency "sqlite3"
24
+ s.add_development_dependency 'redcarpet'
24
25
  end
@@ -1,39 +1,38 @@
1
- #
2
- # File Manager Engine module
3
- #
4
- # @author Xiterrex & Jnillo
5
- #
6
- # @description This module extend the entity which is included and add the methods in the callback before_save
7
- # to register relation between entity's instance and file included.
8
- #
9
-
10
1
  require "file_manager_engine/engine"
2
+ require "file_manager_engine/version"
11
3
 
4
+ # File Manager Engine module
5
+ #
6
+ # @author xiterrex & jnillo
7
+ # @description This module extend the entity in which is included and it adds the methods in the callback +before_save+
8
+ # to register relation between entity's instance and file included.
12
9
  module FileManagerEngine
13
10
  module ClassMethods
11
+ # Name of the field which contains the path of the file
14
12
  mattr_accessor :file_field_name
15
13
  end
16
14
 
17
- # This static method is use to extend methods in other class which included this class
15
+ # This static method is used to extend methods in other +base+ class in which this class is included
16
+ # @param [Class] base class in which this module is included
18
17
  def self.included(base)
19
18
  base.extend(ClassMethods)
20
19
  base.after_save :make_relation_file
21
20
  end
22
21
 
23
- #
24
- # This method generate a instance in data base for each file relationated with the new document generated
25
- # If the content is modifcated, this method remake all relations between file/s and this content.
22
+ # This method creates an instance in database for each file relationated with the new document generated
23
+ # if the content is modifcated, this method remake all relations between file/s and this content.
26
24
  def make_relation_file
27
25
  ary = self.send(self.class.file_field_name.to_sym)
28
26
  to_array(ary).each do |file|
29
- FileManager.new({ :entity_type => self.class.name,:entity_id => self.id, :file => file }).save
27
+ FileManager.new({ :entity_type => self.class.name, :entity_id => self.id, :file => file }).save
30
28
  end
31
29
  end
32
30
 
33
31
  private
34
32
 
35
-
36
- # This methdo has been created to explicit conversion to array elements.
33
+ # This method has been created to force a explicit conversion to Array.
34
+ # @param [Array or Object] val an actual array or whatever kind of object
35
+ # @returns [Array] The same Array or a new Array with +val+ as single element
37
36
  def to_array(val)
38
37
  [val].flatten
39
38
  end
@@ -1,3 +1,3 @@
1
1
  module FileManagerEngine
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/run_tests.sh ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/bash -xe
2
+
3
+ pushd spec/dummy
4
+ rake db:migrate
5
+ rake db:test:prepare
6
+ rake spec
7
+ rake db:drop RAILS_ENV=test
8
+ popd
Binary file
@@ -14,35 +14,34 @@
14
14
  ActiveRecord::Schema.define(:version => 20120925140600) do
15
15
 
16
16
  create_table "articles", :force => true do |t|
17
- t.string "title"
18
- t.string "body"
19
- t.string "path"
20
- t.integer "image_id"
17
+ t.string "title"
18
+ t.string "body"
19
+ t.string "path"
21
20
  t.datetime "created_at", :null => false
22
21
  t.datetime "updated_at", :null => false
23
22
  end
24
23
 
25
24
  create_table "file_managers", :force => true do |t|
26
- t.string "entity_type"
27
- t.string "entity_id"
28
- t.string "file"
29
- t.datetime "created_at", :null => false
30
- t.datetime "updated_at", :null => false
25
+ t.string "entity_type"
26
+ t.string "entity_id"
27
+ t.string "file"
28
+ t.datetime "created_at", :null => false
29
+ t.datetime "updated_at", :null => false
31
30
  end
32
31
 
33
32
  add_index "file_managers", ["entity_type", "entity_id"], :name => "index_file_managers_on_entity_type_and_entity_id"
34
33
  add_index "file_managers", ["file"], :name => "index_file_managers_on_file"
35
34
 
36
35
  create_table "galleries", :force => true do |t|
37
- t.string "name"
38
- t.string "description"
39
- t.datetime "created_at", :null => false
40
- t.datetime "updated_at", :null => false
36
+ t.string "name"
37
+ t.string "description"
38
+ t.datetime "created_at", :null => false
39
+ t.datetime "updated_at", :null => false
41
40
  end
42
41
 
43
42
  create_table "images", :force => true do |t|
44
- t.string "path"
45
- t.string "name"
43
+ t.string "path"
44
+ t.string "name"
46
45
  t.datetime "created_at", :null => false
47
46
  t.datetime "updated_at", :null => false
48
47
  end
@@ -1,126 +1,130 @@
1
1
  Connecting to database specified by database.yml
2
- ActiveRecord::JDBCError: query does not return ResultSet: PRAGMA table_info("schema_migrations")
3
-  (145.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
4
-  (0.0ms) SELECT name, sql FROM sqlite_master WHERE tbl_name = "schema_migrations" AND type = 'index'
5
-  (86.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
6
- ActiveRecord::JDBCError: query does not return ResultSet: PRAGMA table_info("schema_info")
7
-  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
8
- Migrating to CreateFileManager (20120924142907)
9
-  (1.0ms) CREATE TABLE "file_manager" ("id" integer primary key autoincrement not null, "entity_type" varchar(255), "entity_id" varchar(255), "file" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
10
-  (0.0ms) SELECT name, sql FROM sqlite_master WHERE tbl_name = "file_manager_file_idx" AND type = 'index'
11
-  (3.0ms) CREATE INDEX "index_file_manager_file_idx_on_file" ON "file_manager_file_idx" ("file")
12
- ActiveRecord::JDBCError: [SQLITE_ERROR] SQL error or missing database (no such table: main.file_manager_file_idx): CREATE INDEX "index_file_manager_file_idx_on_file" ON "file_manager_file_idx" ("file")
13
- Connecting to database specified by database.yml
2
+  (0.2ms) select sqlite_version(*)
3
+  (166.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
4
+  (0.1ms) PRAGMA index_list("schema_migrations")
5
+  (133.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
6
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
14
7
  Connecting to database specified by database.yml
15
-  (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
8
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
16
9
  Migrating to CreateImages (20120924145423)
17
-  (1.0ms) CREATE TABLE "images" ("id" integer primary key autoincrement not null, "path" varchar(255), "name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
18
-  (1.0ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120924145423')
10
+  (0.1ms) select sqlite_version(*)
11
+  (0.0ms) begin transaction
12
+  (0.6ms) CREATE TABLE "images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "path" varchar(255), "name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
13
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120924145423')
14
+  (173.8ms) commit transaction
19
15
  Migrating to CreateArticles (20120924150641)
20
-  (0.0ms) CREATE TABLE "articles" ("id" integer primary key autoincrement not null, "title" varchar(255), "body" varchar(255), "path" varchar(255), "image_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
21
-  (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120924150641')
16
+  (0.1ms) begin transaction
17
+  (0.5ms) CREATE TABLE "articles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" varchar(255), "path" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
18
+  (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120924150641')
19
+  (175.4ms) commit transaction
22
20
  Migrating to CreateGalleries (20120924151353)
23
-  (0.0ms) CREATE TABLE "galleries" ("id" integer primary key autoincrement not null, "name" varchar(255), "description" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
24
-  (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120924151353')
25
-  (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
26
-  (0.0ms)  SELECT name
27
- FROM sqlite_master
28
- WHERE type = 'table' AND NOT name = 'sqlite_sequence'
29
- 
30
-  (1.0ms) SELECT name, sql FROM sqlite_master WHERE tbl_name = "articles" AND type = 'index'
31
-  (0.0ms) SELECT name, sql FROM sqlite_master WHERE tbl_name = "galleries" AND type = 'index'
32
-  (1.0ms) SELECT name, sql FROM sqlite_master WHERE tbl_name = "images" AND type = 'index'
33
- Connecting to database specified by database.yml
21
+  (0.1ms) begin transaction
22
+  (0.4ms) CREATE TABLE "galleries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
23
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120924151353')
24
+  (153.1ms) commit transaction
25
+ Migrating to CreateFileManager (20120925140600)
26
+  (0.1ms) begin transaction
27
+  (0.6ms) CREATE TABLE "file_managers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "entity_type" varchar(255), "entity_id" varchar(255), "file" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
28
+  (0.1ms) PRAGMA index_list("file_managers")
29
+  (0.2ms) CREATE INDEX "index_file_managers_on_file" ON "file_managers" ("file")
30
+  (0.1ms) PRAGMA index_list("file_managers")
31
+  (0.1ms) PRAGMA index_info('index_file_managers_on_file')
32
+  (0.2ms) CREATE INDEX "index_file_managers_on_entity_type_and_entity_id" ON "file_managers" ("entity_type", "entity_id")
33
+  (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120925140600')
34
+  (149.9ms) commit transaction
35
+  (0.3ms) select sqlite_version(*)
36
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
37
+  (0.0ms) PRAGMA index_list("articles")
38
+  (0.0ms) PRAGMA index_list("file_managers")
39
+  (0.0ms) PRAGMA index_info('index_file_managers_on_entity_type_and_entity_id')
40
+  (0.0ms) PRAGMA index_info('index_file_managers_on_file')
41
+  (0.0ms) PRAGMA index_list("galleries")
42
+  (0.0ms) PRAGMA index_list("images")
34
43
  Connecting to database specified by database.yml
35
44
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
36
45
   (0.3ms) select sqlite_version(*)
37
-  (204.8ms) CREATE TABLE "articles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" varchar(255), "path" varchar(255), "image_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
38
-  (166.1ms) CREATE TABLE "galleries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
39
-  (188.2ms) CREATE TABLE "images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "path" varchar(255), "name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
40
-  (189.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
46
+  (301.6ms) CREATE TABLE "articles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" varchar(255), "path" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
47
+  (165.7ms) CREATE TABLE "file_managers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "entity_type" varchar(255), "entity_id" varchar(255), "file" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
48
+  (0.1ms) PRAGMA index_list("file_managers")
49
+  (155.6ms) CREATE INDEX "index_file_managers_on_entity_type_and_entity_id" ON "file_managers" ("entity_type", "entity_id")
50
+  (0.1ms) PRAGMA index_list("file_managers")
51
+  (0.1ms) PRAGMA index_info('index_file_managers_on_entity_type_and_entity_id')
52
+  (178.0ms) CREATE INDEX "index_file_managers_on_file" ON "file_managers" ("file")
53
+  (178.5ms) CREATE TABLE "galleries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
54
+  (165.9ms) CREATE TABLE "images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "path" varchar(255), "name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
55
+  (166.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
41
56
   (0.1ms) PRAGMA index_list("schema_migrations")
42
-  (245.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
57
+  (144.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
43
58
   (0.1ms) SELECT version FROM "schema_migrations"
44
-  (177.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924151353')
45
-  (189.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924145423')
46
-  (189.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924150641')
59
+  (144.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20120925140600')
60
+  (145.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924145423')
61
+  (134.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924151353')
62
+  (134.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924150641')
47
63
  Connecting to database specified by database.yml
48
64
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
49
65
  Migrating to CreateImages (20120924145423)
50
66
  Migrating to CreateArticles (20120924150641)
51
67
  Migrating to CreateGalleries (20120924151353)
52
-  (0.2ms) select sqlite_version(*)
68
+ Migrating to CreateFileManager (20120925140600)
69
+  (0.4ms) select sqlite_version(*)
53
70
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
54
71
   (0.0ms) PRAGMA index_list("articles")
55
-  (0.0ms) PRAGMA index_list("galleries")
56
-  (0.0ms) PRAGMA index_list("images")
57
- Connecting to database specified by database.yml
58
-  (1.6ms) select sqlite_version(*)
59
-  (211.8ms) CREATE TABLE "articles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" varchar(255), "path" varchar(255), "image_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
60
-  (165.6ms) CREATE TABLE "galleries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
61
-  (188.2ms) CREATE TABLE "images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "path" varchar(255), "name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
62
-  (157.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
63
-  (0.1ms) PRAGMA index_list("schema_migrations")
64
-  (189.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
65
-  (0.1ms) SELECT version FROM "schema_migrations"
66
-  (155.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924151353')
67
-  (189.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924145423')
68
-  (167.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924150641')
69
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
72
+  (0.1ms) PRAGMA index_list("file_managers")
73
+  (0.1ms) PRAGMA index_info('index_file_managers_on_entity_type_and_entity_id')
74
+  (0.0ms) PRAGMA index_info('index_file_managers_on_file')
75
+  (0.0ms) PRAGMA index_list("galleries")
76
+  (0.0ms) PRAGMA index_list("images")
70
77
  Connecting to database specified by database.yml
71
78
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
72
79
   (0.3ms) select sqlite_version(*)
73
-  (193.1ms) CREATE TABLE "articles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" varchar(255), "path" varchar(255), "image_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
74
-  (198.2ms) CREATE TABLE "galleries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
75
-  (191.4ms) CREATE TABLE "images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "path" varchar(255), "name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
76
-  (189.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
80
+  (562.7ms) CREATE TABLE "articles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" varchar(255), "path" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
81
+  (232.7ms) CREATE TABLE "file_managers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "entity_type" varchar(255), "entity_id" varchar(255), "file" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
82
+  (0.1ms) PRAGMA index_list("file_managers")
83
+  (302.2ms) CREATE INDEX "index_file_managers_on_entity_type_and_entity_id" ON "file_managers" ("entity_type", "entity_id")
84
+  (0.1ms) PRAGMA index_list("file_managers")
85
+  (0.1ms) PRAGMA index_info('index_file_managers_on_entity_type_and_entity_id')
86
+  (300.4ms) CREATE INDEX "index_file_managers_on_file" ON "file_managers" ("file")
87
+  (266.7ms) CREATE TABLE "galleries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
88
+  (373.4ms) CREATE TABLE "images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "path" varchar(255), "name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
89
+  (274.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
77
90
   (0.1ms) PRAGMA index_list("schema_migrations")
78
-  (178.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
91
+  (211.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
79
92
   (0.1ms) SELECT version FROM "schema_migrations"
80
-  (177.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924151353')
81
-  (223.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924145423')
82
-  (211.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924150641')
93
+  (179.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20120925140600')
94
+  (168.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924145423')
95
+  (223.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924151353')
96
+  (256.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924150641')
83
97
  Connecting to database specified by database.yml
84
98
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
85
99
  Migrating to CreateImages (20120924145423)
86
100
  Migrating to CreateArticles (20120924150641)
87
101
  Migrating to CreateGalleries (20120924151353)
88
102
  Migrating to CreateFileManager (20120925140600)
89
-  (0.1ms) select sqlite_version(*)
90
-  (0.0ms) begin transaction
91
-  (0.6ms) CREATE TABLE "file_managers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "entity_type" varchar(255), "entity_id" varchar(255), "file" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
92
-  (0.1ms) PRAGMA index_list("file_managers")
93
-  (0.2ms) CREATE INDEX "index_file_managers_on_file" ON "file_managers" ("file")
94
-  (0.1ms) PRAGMA index_list("file_managers")
95
-  (0.0ms) PRAGMA index_info('index_file_managers_on_file')
96
-  (0.2ms) CREATE INDEX "index_file_managers_on_entity_type_and_entity_id" ON "file_managers" ("entity_type", "entity_id")
97
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120925140600')
98
-  (213.1ms) commit transaction
99
-  (0.6ms) select sqlite_version(*)
103
+  (0.3ms) select sqlite_version(*)
100
104
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
101
105
   (0.0ms) PRAGMA index_list("articles")
102
106
   (0.0ms) PRAGMA index_list("file_managers")
103
-  (0.2ms) PRAGMA index_info('index_file_managers_on_entity_type_and_entity_id')
107
+  (0.1ms) PRAGMA index_info('index_file_managers_on_entity_type_and_entity_id')
104
108
   (0.0ms) PRAGMA index_info('index_file_managers_on_file')
105
109
   (0.0ms) PRAGMA index_list("galleries")
106
110
   (0.0ms) PRAGMA index_list("images")
107
111
  Connecting to database specified by database.yml
108
112
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
109
-  (0.3ms) select sqlite_version(*)
110
-  (199.2ms) CREATE TABLE "articles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" varchar(255), "path" varchar(255), "image_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
111
-  (177.7ms) CREATE TABLE "file_managers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "entity_type" varchar(255), "entity_id" varchar(255), "file" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
113
+  (0.2ms) select sqlite_version(*)
114
+  (168.7ms) CREATE TABLE "articles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" varchar(255), "path" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
115
+  (154.6ms) CREATE TABLE "file_managers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "entity_type" varchar(255), "entity_id" varchar(255), "file" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
112
116
   (0.1ms) PRAGMA index_list("file_managers")
113
-  (166.6ms) CREATE INDEX "index_file_managers_on_entity_type_and_entity_id" ON "file_managers" ("entity_type", "entity_id")
117
+  (177.9ms) CREATE INDEX "index_file_managers_on_entity_type_and_entity_id" ON "file_managers" ("entity_type", "entity_id")
114
118
   (0.1ms) PRAGMA index_list("file_managers")
115
119
   (0.1ms) PRAGMA index_info('index_file_managers_on_entity_type_and_entity_id')
116
-  (189.0ms) CREATE INDEX "index_file_managers_on_file" ON "file_managers" ("file")
117
-  (221.8ms) CREATE TABLE "galleries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
118
-  (177.1ms) CREATE TABLE "images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "path" varchar(255), "name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
119
-  (177.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
120
+  (177.7ms) CREATE INDEX "index_file_managers_on_file" ON "file_managers" ("file")
121
+  (200.2ms) CREATE TABLE "galleries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
122
+  (222.0ms) CREATE TABLE "images" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "path" varchar(255), "name" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
123
+  (189.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
120
124
   (0.1ms) PRAGMA index_list("schema_migrations")
121
-  (178.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
125
+  (233.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
122
126
   (0.1ms) SELECT version FROM "schema_migrations"
123
-  (178.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20120925140600')
124
-  (167.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924145423')
125
-  (178.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924151353')
126
-  (170.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924150641')
127
+  (168.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20120925140600')
128
+  (222.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924145423')
129
+  (200.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924151353')
130
+  (178.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20120924150641')