nostalgic 0.1.7 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e26badaf65300d38f61266c2f100ef26b2373ab
4
- data.tar.gz: ac2c04fac8a683751bb42b1fbb9e7d0eb4233e22
3
+ metadata.gz: 77779e214409136c7495dc9dd2f28aaf1afe4e83
4
+ data.tar.gz: bbfb7af9e4f93ff8d3ba42f17a4ae601a1e67540
5
5
  SHA512:
6
- metadata.gz: 821b330a18dd8d26327123ea82dd39cce987a3eaf0cf575d2267996047a4a26496d666d088ea733c5975328289741d3418523fc981dad485ed0fd9aa02d0b69c
7
- data.tar.gz: d69dfd09be25d0a29df67e703ff1a2bf11831406d775ef74d9ee5a6b78c466f83547ab2feeaca8026254b909bf8ec6bf9ded115518cf7fe199abef448cc7fcda
6
+ metadata.gz: 8bf30e4ab63b106f1062934b312ae1f106f2c53e879649eb2e4057f7d363fe9418284de92a431cd4a8e2e2a0ab8141de046fad105209a7bbcf369778fd2b9e21
7
+ data.tar.gz: a4b752b98c30f7d108fcc97d9080c31a2ce9510830226cdcc879d8c722968b6c80468854424925d83d85cb1908c693636140f5734939ba4ee293badd712f9051
@@ -0,0 +1,30 @@
1
+ <table class="nostalgic">
2
+ <thead>
3
+ <tr>
4
+ <td>
5
+ <%= f.collection_select attr, collection, value_method, text_method, options, html_options %>
6
+ </td>
7
+ <td>
8
+ <%= f.text_field "#{attr}_effective_at", :class => 'datepicker', :style => 'display: none;' %>
9
+ <%= image_tag 'nostalgic/list.png', :onclick => 'nostalgic.edit_nostalgic_attr(this); return false;' %>
10
+ </td>
11
+ </tr>
12
+ </thead>
13
+ <tbody style="display: none;">
14
+ <% f.object.public_send(attr.to_s.pluralize).each_with_index do |nostalgic_attr, i| %>
15
+ <%= f.fields_for "#{attr.to_s.pluralize}_attributes][#{i}]", nostalgic_attr do |f| %>
16
+ <tr>
17
+ <td>
18
+ <%= f.hidden_field :id %>
19
+ <%= f.hidden_field :_destroy %>
20
+ <%= f.collection_select :value, collection, value_method, text_method, options, html_options.merge(:disabled => true, :readonly => true) %>
21
+ </td>
22
+ <td>
23
+ <%= f.text_field :effective_at, :class => 'datepicker', :disabled => true, :readonly => true %>
24
+ <%= image_tag 'nostalgic/minus.png', :onclick => 'nostalgic.remove_row(this); return false;' %>
25
+ </td>
26
+ </tr>
27
+ <% end %>
28
+ <% end %>
29
+ </tbody>
30
+ </table>
@@ -7,4 +7,10 @@ class ActionView::Helpers::FormBuilder
7
7
  @template.render 'nostalgic/text_field', :f => self, :attr => method, :css_class => options[:class]
8
8
  end
9
9
 
10
+ def nostalgic_collection_select(method, collection, value_method, text_method, options = {}, html_options = {})
11
+ @template.render 'nostalgic/collection_select',
12
+ :f => self, :attr => method, :collection => collection, :value_method => value_method, :text_method => text_method,
13
+ :options => options, :html_options => html_options
14
+ end
15
+
10
16
  end
@@ -38,6 +38,26 @@ module Nostalgic
38
38
  module ClassMethods
39
39
  attr_accessor :nostalgic_attrs
40
40
 
41
+ def belongs_to(name, scope = nil, options = {})
42
+ scope ||= {}
43
+ super(name, scope.except(:nostalgic), options)
44
+
45
+ if scope.fetch(:nostalgic, false)
46
+ foreign_key = options.fetch(:foreign_key, "#{name}_id")
47
+ nostalgic_for foreign_key
48
+
49
+ class_eval <<-METHODS, __FILE__, __LINE__ + 1
50
+ def #{name}_on(date)
51
+ return self.#{name} unless date.present?
52
+
53
+ '#{name}'.classify.constantize.find_by_id(#{foreign_key}_at(date))
54
+ end
55
+
56
+ alias_method :#{name}_at, :#{name}_on
57
+ METHODS
58
+ end
59
+ end
60
+
41
61
  def nostalgic_for(*attrs)
42
62
  self.nostalgic_attrs ||= []
43
63
 
@@ -54,7 +74,7 @@ module Nostalgic
54
74
  attr_accessor :#{attr}_effective_at
55
75
 
56
76
  def #{attr}_on(date)
57
- raise ArgumentError.new if date.nil?
77
+ return self.#{attr} unless date.present?
58
78
 
59
79
  na = Nostalgic::Attr.where(:model_type => self.class.name, :model_id => self.id, :name => '#{attr}')
60
80
  na = na.where('effective_at <= ?', date).order('effective_at desc').first
@@ -62,7 +82,6 @@ module Nostalgic
62
82
  end
63
83
 
64
84
  alias_method :#{attr}_at, :#{attr}_on
65
-
66
85
  METHODS
67
86
  end
68
87
  end
@@ -1,3 +1,3 @@
1
1
  module Nostalgic
2
- VERSION = '0.1.7'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -0,0 +1,3 @@
1
+ class Company < ActiveRecord::Base
2
+ has_many :users
3
+ end
@@ -1,3 +1,4 @@
1
1
  class User < ActiveRecord::Base
2
+ belongs_to :company, :nostalgic => true
2
3
  nostalgic_for :tel
3
4
  end
Binary file
@@ -0,0 +1,8 @@
1
+ class CreateCompanies < ActiveRecord::Migration
2
+ def change
3
+ create_table :companies do |t|
4
+ t.string :name, null: false
5
+ t.timestamps null: false
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ class AddColumnCompanyIdOnUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :company_id, :integer
4
+ end
5
+ end
@@ -11,7 +11,13 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20160816080822) do
14
+ ActiveRecord::Schema.define(version: 20161217105921) do
15
+
16
+ create_table "companies", force: :cascade do |t|
17
+ t.string "name", null: false
18
+ t.datetime "created_at", null: false
19
+ t.datetime "updated_at", null: false
20
+ end
15
21
 
16
22
  create_table "nostalgic_attrs", force: :cascade do |t|
17
23
  t.string "model_type", null: false
@@ -28,6 +34,7 @@ ActiveRecord::Schema.define(version: 20160816080822) do
28
34
  t.string "tel"
29
35
  t.datetime "created_at", null: false
30
36
  t.datetime "updated_at", null: false
37
+ t.integer "company_id"
31
38
  end
32
39
 
33
40
  end
Binary file
@@ -559,3 +559,341 @@ Migrating to ChangeColumnUpdatedAtOnNostalgicAttrs (20160816080822)
559
559
   (1.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807101438')
560
560
   (1.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080815')
561
561
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
562
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
563
+ Migrating to AddIndexIdAndTypeAndNameOnNostalgicAttrs (20161120085751)
564
+  (0.0ms) begin transaction
565
+  (0.1ms) select sqlite_version(*)
566
+  (0.3ms) CREATE INDEX "index_nostalgic_attrs_on_model_id_and_model_type_and_name" ON "nostalgic_attrs" ("model_id", "model_type", "name")
567
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161120085751"]]
568
+  (2.4ms) commit transaction
569
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
570
+  (0.1ms) SELECT sql
571
+ FROM sqlite_master
572
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
573
+ UNION ALL
574
+ SELECT sql
575
+ FROM sqlite_temp_master
576
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
577
+
578
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
579
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
580
+ Migrating to AddIndexIdAndTypeAndNameOnNostalgicAttrs (20161120085751)
581
+  (0.0ms) begin transaction
582
+  (0.1ms) SELECT sql
583
+ FROM sqlite_master
584
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
585
+ UNION ALL
586
+ SELECT sql
587
+ FROM sqlite_temp_master
588
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
589
+
590
+  (0.3ms) DROP INDEX "index_nostalgic_attrs_on_model_id_and_model_type_and_name"
591
+ SQL (0.1ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = ? [["version", "20161120085751"]]
592
+  (1.8ms) commit transaction
593
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
594
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
595
+ Migrating to AddIndexIdAndTypeAndNameOnNostalgicAttrs (20161120085751)
596
+  (0.0ms) begin transaction
597
+  (0.1ms) select sqlite_version(*)
598
+  (0.2ms) CREATE INDEX "index_nostalgic_attrs_on_model_id_and_model_type_and_name" ON "nostalgic_attrs" ("model_id", "model_type", "name")
599
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161120085751"]]
600
+  (2.1ms) commit transaction
601
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
602
+  (0.1ms) SELECT sql
603
+ FROM sqlite_master
604
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
605
+ UNION ALL
606
+ SELECT sql
607
+ FROM sqlite_temp_master
608
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
609
+
610
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
611
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
612
+  (0.1ms)  SELECT sql
613
+ FROM sqlite_master
614
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
615
+ UNION ALL
616
+ SELECT sql
617
+ FROM sqlite_temp_master
618
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
619
+ 
620
+  (2.4ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
621
+  (0.1ms) select sqlite_version(*)
622
+  (1.3ms) CREATE INDEX "index_nostalgic_attrs_on_model_id_and_model_type_and_name" ON "nostalgic_attrs" ("model_id", "model_type", "name")
623
+  (1.5ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
624
+  (2.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
625
+  (2.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
626
+  (0.1ms) SELECT version FROM "schema_migrations"
627
+  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20161120085751')
628
+  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
629
+  (1.1ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime)
630
+  (0.0ms) select sqlite_version(*)
631
+  (1.3ms) CREATE INDEX "index_nostalgic_attrs_on_model_id_and_model_type_and_name" ON "nostalgic_attrs" ("model_id", "model_type", "name")
632
+  (1.4ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
633
+  (1.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
634
+  (1.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
635
+  (0.1ms) SELECT version FROM "schema_migrations"
636
+  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20161120085751')
637
+  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
638
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
639
+  (3.3ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
640
+  (0.1ms) select sqlite_version(*)
641
+  (2.0ms) CREATE INDEX "index_nostalgic_attrs_on_model_id_and_model_type_and_name" ON "nostalgic_attrs" ("model_id", "model_type", "name")
642
+  (2.0ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
643
+  (2.0ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
644
+  (2.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
645
+  (0.1ms) SELECT version FROM "schema_migrations"
646
+  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20161120085751')
647
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
648
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807101438')
649
+  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080815')
650
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
651
+  (1.3ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
652
+  (0.1ms) select sqlite_version(*)
653
+  (1.3ms) CREATE INDEX "index_nostalgic_attrs_on_model_id_and_model_type_and_name" ON "nostalgic_attrs" ("model_id", "model_type", "name")
654
+  (1.7ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
655
+  (1.5ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
656
+  (1.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
657
+  (0.1ms) SELECT version FROM "schema_migrations"
658
+  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20161120085751')
659
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
660
+  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807101438')
661
+  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080815')
662
+  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
663
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
664
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
665
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
666
+  (0.1ms)  SELECT sql
667
+ FROM sqlite_master
668
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
669
+ UNION ALL
670
+ SELECT sql
671
+ FROM sqlite_temp_master
672
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
673
+ 
674
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
675
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
676
+ Migrating to AddIndexModelIdAndModelTypeAndNameOnNostalgicAttrs (20161120085751)
677
+  (0.0ms) begin transaction
678
+  (0.1ms) SELECT sql
679
+ FROM sqlite_master
680
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
681
+ UNION ALL
682
+ SELECT sql
683
+ FROM sqlite_temp_master
684
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
685
+
686
+  (0.2ms) DROP INDEX "index_nostalgic_attrs_on_model_id_and_model_type_and_name"
687
+ SQL (0.1ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = ? [["version", "20161120085751"]]
688
+  (2.8ms) commit transaction
689
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
690
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
691
+ Migrating to AddIndexModelIdAndModelTypeAndNameOnNostalgicAttrs (20161120085751)
692
+  (0.0ms) begin transaction
693
+  (0.1ms) select sqlite_version(*)
694
+  (0.2ms) CREATE INDEX "index_nostalgic_attrs_on_model_id_and_model_type_and_name" ON "nostalgic_attrs" ("model_id", "model_type", "name")
695
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161120085751"]]
696
+  (1.6ms) commit transaction
697
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
698
+  (0.1ms) SELECT sql
699
+ FROM sqlite_master
700
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
701
+ UNION ALL
702
+ SELECT sql
703
+ FROM sqlite_temp_master
704
+ WHERE name='index_nostalgic_attrs_on_model_id_and_model_type_and_name' AND type='index'
705
+
706
+  (1.9ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
707
+  (1.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
708
+  (1.8ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
709
+  (0.1ms) select sqlite_version(*)
710
+  (2.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
711
+  (0.1ms) SELECT version FROM "schema_migrations"
712
+  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
713
+  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
714
+  (1.5ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
715
+  (1.5ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
716
+  (1.7ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
717
+  (0.1ms) select sqlite_version(*)
718
+  (1.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
719
+  (0.2ms) SELECT version FROM "schema_migrations"
720
+  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
721
+  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
722
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
723
+  (3.4ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
724
+  (2.4ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
725
+  (2.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
726
+  (0.2ms) select sqlite_version(*)
727
+  (2.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
728
+  (0.1ms) SELECT version FROM "schema_migrations"
729
+  (2.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
730
+  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
731
+  (2.8ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
732
+  (1.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
733
+  (2.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
734
+  (0.1ms) select sqlite_version(*)
735
+  (2.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
736
+  (0.2ms) SELECT version FROM "schema_migrations"
737
+  (2.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
738
+  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
739
+  (1.4ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
740
+  (1.5ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
741
+  (1.8ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
742
+  (0.1ms) select sqlite_version(*)
743
+  (4.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
744
+  (0.1ms) SELECT version FROM "schema_migrations"
745
+  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
746
+  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
747
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
748
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
749
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
750
+  (3.7ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
751
+  (2.1ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
752
+  (2.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
753
+  (0.1ms) select sqlite_version(*)
754
+  (1.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
755
+  (0.2ms) SELECT version FROM "schema_migrations"
756
+  (2.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
757
+  (2.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
758
+  (1.6ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
759
+  (1.6ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
760
+  (1.8ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
761
+  (0.1ms) select sqlite_version(*)
762
+  (1.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
763
+  (0.1ms) SELECT version FROM "schema_migrations"
764
+  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
765
+  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
766
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
767
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
768
+ Migrating to CreateNostalgicAttrs (20160807101438)
769
+  (0.0ms) begin transaction
770
+  (0.1ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
771
+  (0.0ms) rollback transaction
772
+  (3.2ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
773
+  (1.6ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
774
+  (2.6ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
775
+  (0.1ms) select sqlite_version(*)
776
+  (1.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
777
+  (0.1ms) SELECT version FROM "schema_migrations"
778
+  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
779
+  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
780
+  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807101438')
781
+  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080815')
782
+  (1.3ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
783
+  (1.5ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
784
+  (1.7ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
785
+  (0.1ms) select sqlite_version(*)
786
+  (1.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
787
+  (0.1ms) SELECT version FROM "schema_migrations"
788
+  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
789
+  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
790
+  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807101438')
791
+  (2.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080815')
792
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
793
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
794
+ Migrating to CreateCompanies (20161217105723)
795
+  (0.0ms) begin transaction
796
+  (0.6ms) CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
797
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161217105723"]]
798
+  (3.0ms) commit transaction
799
+ Migrating to AddColumnCompanyIdOnUsers (20161217105921)
800
+  (0.1ms) begin transaction
801
+  (0.3ms) ALTER TABLE "users" ADD "company_id" integer
802
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161217105921"]]
803
+  (1.9ms) commit transaction
804
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
805
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
806
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
807
+ Migrating to AddColumnCompanyIdOnUsers (20161217105921)
808
+  (0.0ms) begin transaction
809
+  (0.4ms) CREATE TEMPORARY TABLE "ausers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "company_id" integer)
810
+  (0.0ms) SELECT * FROM "users"
811
+  (0.2ms) DROP TABLE "users"
812
+  (0.1ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
813
+  (0.0ms) SELECT * FROM "ausers"
814
+  (0.1ms) DROP TABLE "ausers"
815
+ SQL (0.1ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = ? [["version", "20161217105921"]]
816
+  (2.3ms) commit transaction
817
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
818
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
819
+ Migrating to AddColumnCompanyIdOnUsers (20161217105921)
820
+  (0.0ms) begin transaction
821
+  (0.2ms) ALTER TABLE "users" ADD "company_id" integer NOT NULL
822
+  (0.0ms) rollback transaction
823
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
824
+ Migrating to AddColumnCompanyIdOnUsers (20161217105921)
825
+  (0.0ms) begin transaction
826
+  (0.4ms) ALTER TABLE "users" ADD "company_id" integer
827
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161217105921"]]
828
+  (3.1ms) commit transaction
829
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
830
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
831
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
832
+ Migrating to AddColumnCompanyIdOnUsers (20161217105921)
833
+  (0.0ms) begin transaction
834
+  (0.4ms) CREATE TEMPORARY TABLE "ausers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "company_id" integer)
835
+  (0.0ms) SELECT * FROM "users"
836
+  (0.1ms) DROP TABLE "users"
837
+  (0.1ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
838
+  (0.0ms) SELECT * FROM "ausers"
839
+  (0.1ms) DROP TABLE "ausers"
840
+ SQL (0.1ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = ? [["version", "20161217105921"]]
841
+  (2.8ms) commit transaction
842
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
843
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
844
+ Migrating to AddColumnCompanyIdOnUsers (20161217105921)
845
+  (0.0ms) begin transaction
846
+  (0.3ms) ALTER TABLE "users" ADD "company_id" integer
847
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20161217105921"]]
848
+  (2.0ms) commit transaction
849
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
850
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
851
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
852
+  (2.6ms) CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
853
+  (1.7ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime)
854
+  (1.4ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "company_id" integer) 
855
+  (2.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
856
+  (0.1ms) select sqlite_version(*)
857
+  (2.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
858
+  (0.1ms) SELECT version FROM "schema_migrations"
859
+  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20161217105921')
860
+  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
861
+  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20161217105723')
862
+  (1.3ms) CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
863
+  (1.4ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime)
864
+  (1.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "company_id" integer) 
865
+  (1.7ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
866
+  (0.1ms) select sqlite_version(*)
867
+  (1.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
868
+  (0.1ms) SELECT version FROM "schema_migrations"
869
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20161217105921')
870
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
871
+  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20161217105723')
872
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
873
+  (2.7ms) CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
874
+  (1.4ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime)
875
+  (1.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "company_id" integer) 
876
+  (2.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
877
+  (0.1ms) select sqlite_version(*)
878
+  (1.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
879
+  (0.1ms) SELECT version FROM "schema_migrations"
880
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20161217105921')
881
+  (1.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
882
+  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20161217105723')
883
+  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807101438')
884
+  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080815')
885
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
886
+  (1.2ms) CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
887
+  (1.6ms) CREATE TABLE "nostalgic_attrs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "model_type" varchar NOT NULL, "model_id" integer NOT NULL, "name" varchar NOT NULL, "value" varchar, "effective_at" date NOT NULL, "created_at" datetime, "updated_at" datetime) 
888
+  (1.5ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "tel" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "company_id" integer)
889
+  (1.7ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
890
+  (0.1ms) select sqlite_version(*)
891
+  (1.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
892
+  (0.1ms) SELECT version FROM "schema_migrations"
893
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20161217105921')
894
+  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807103323')
895
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20161217105723')
896
+  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20160807101438')
897
+  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080815')
898
+  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20160816080822')
899
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"