historiographer 4.0.0 → 4.1.1

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +115 -39
  3. data/lib/historiographer/configuration.rb +36 -0
  4. data/lib/historiographer/history.rb +9 -2
  5. data/lib/historiographer/history_migration.rb +9 -6
  6. data/lib/historiographer/relation.rb +1 -1
  7. data/lib/historiographer/version.rb +3 -0
  8. data/lib/historiographer.rb +176 -11
  9. metadata +3 -30
  10. data/.document +0 -5
  11. data/.rspec +0 -1
  12. data/.ruby-version +0 -1
  13. data/.standalone_migrations +0 -6
  14. data/Gemfile +0 -34
  15. data/Gemfile.lock +0 -289
  16. data/Guardfile +0 -70
  17. data/Rakefile +0 -54
  18. data/VERSION +0 -1
  19. data/historiographer.gemspec +0 -106
  20. data/init.rb +0 -18
  21. data/spec/db/database.yml +0 -25
  22. data/spec/db/migrate/20161121212228_create_posts.rb +0 -19
  23. data/spec/db/migrate/20161121212229_create_post_histories.rb +0 -10
  24. data/spec/db/migrate/20161121212230_create_authors.rb +0 -13
  25. data/spec/db/migrate/20161121212231_create_author_histories.rb +0 -10
  26. data/spec/db/migrate/20161121212232_create_users.rb +0 -9
  27. data/spec/db/migrate/20171011194624_create_safe_posts.rb +0 -19
  28. data/spec/db/migrate/20171011194715_create_safe_post_histories.rb +0 -9
  29. data/spec/db/migrate/20191024142304_create_thing_with_compound_index.rb +0 -10
  30. data/spec/db/migrate/20191024142352_create_thing_with_compound_index_history.rb +0 -11
  31. data/spec/db/migrate/20191024203106_create_thing_without_history.rb +0 -7
  32. data/spec/db/migrate/20221018204220_create_silent_posts.rb +0 -21
  33. data/spec/db/migrate/20221018204255_create_silent_post_histories.rb +0 -9
  34. data/spec/db/schema.rb +0 -186
  35. data/spec/examples.txt +0 -32
  36. data/spec/factories/post.rb +0 -7
  37. data/spec/historiographer_spec.rb +0 -588
  38. data/spec/spec_helper.rb +0 -52
@@ -1,19 +0,0 @@
1
- class CreateSafePosts < ActiveRecord::Migration[5.1]
2
- def change
3
- create_table :safe_posts do |t|
4
- t.string :title, null: false
5
- t.text :body, null: false
6
- t.integer :author_id, null: false
7
- t.boolean :enabled, default: false
8
- t.datetime :live_at
9
- t.datetime :deleted_at
10
-
11
- t.timestamps
12
- end
13
-
14
- add_index :safe_posts, :author_id
15
- add_index :safe_posts, :enabled
16
- add_index :safe_posts, :live_at
17
- add_index :safe_posts, :deleted_at
18
- end
19
- end
@@ -1,9 +0,0 @@
1
- require "historiographer/postgres_migration"
2
-
3
- class CreateSafePostHistories < ActiveRecord::Migration[5.1]
4
- def change
5
- create_table :safe_post_histories do |t|
6
- t.histories
7
- end
8
- end
9
- end
@@ -1,10 +0,0 @@
1
- class CreateThingWithCompoundIndex < ActiveRecord::Migration[5.2]
2
- def change
3
- create_table :thing_with_compound_indices do |t|
4
- t.string :key
5
- t.string :value
6
-
7
- t.index [:key, :value], name: "idx_key_value"
8
- end
9
- end
10
- end
@@ -1,11 +0,0 @@
1
- require "historiographer/postgres_migration"
2
- class CreateThingWithCompoundIndexHistory < ActiveRecord::Migration[5.2]
3
- def change
4
- create_table :thing_with_compound_index_histories do |t|
5
- t.histories index_names: {
6
- [:key, :value] => "idx_history_k_v",
7
- :thing_with_compound_index_id => "idx_k_v_histories"
8
- }
9
- end
10
- end
11
- end
@@ -1,7 +0,0 @@
1
- class CreateThingWithoutHistory < ActiveRecord::Migration[5.2]
2
- def change
3
- create_table :thing_without_histories do |t|
4
- t.string :name
5
- end
6
- end
7
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CreateSilentPosts < ActiveRecord::Migration[5.1]
4
- def change
5
- create_table :silent_posts do |t|
6
- t.string :title, null: false
7
- t.text :body, null: false
8
- t.integer :author_id, null: false
9
- t.boolean :enabled, default: false
10
- t.datetime :live_at
11
- t.datetime :deleted_at
12
-
13
- t.timestamps
14
- end
15
-
16
- add_index :silent_posts, :author_id
17
- add_index :silent_posts, :enabled
18
- add_index :silent_posts, :live_at
19
- add_index :silent_posts, :deleted_at
20
- end
21
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'historiographer/postgres_migration'
4
-
5
- class CreateSilentPostHistories < ActiveRecord::Migration[5.1]
6
- def change
7
- create_table :silent_post_histories, &:histories
8
- end
9
- end
data/spec/db/schema.rb DELETED
@@ -1,186 +0,0 @@
1
- # This file is auto-generated from the current state of the database. Instead
2
- # of editing this file, please use the migrations feature of Active Record to
3
- # incrementally modify your database, and then regenerate this schema definition.
4
- #
5
- # This file is the source Rails uses to define your schema when running `bin/rails
6
- # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
- # be faster and is potentially less error prone than running all of your
8
- # migrations from scratch. Old migrations may fail to apply correctly if those
9
- # migrations use external dependencies or application code.
10
- #
11
- # It's strongly recommended that you check this file into your version control system.
12
-
13
- ActiveRecord::Schema.define(version: 2022_10_18_204255) do
14
-
15
- # These are extensions that must be enabled in order to support this database
16
- enable_extension "plpgsql"
17
-
18
- create_table "author_histories", force: :cascade do |t|
19
- t.integer "author_id", null: false
20
- t.string "full_name", null: false
21
- t.text "bio"
22
- t.datetime "deleted_at"
23
- t.datetime "created_at", null: false
24
- t.datetime "updated_at", null: false
25
- t.datetime "history_started_at", null: false
26
- t.datetime "history_ended_at"
27
- t.integer "history_user_id"
28
- t.index ["author_id"], name: "index_author_histories_on_author_id"
29
- t.index ["deleted_at"], name: "index_author_histories_on_deleted_at"
30
- t.index ["history_ended_at"], name: "index_author_histories_on_history_ended_at"
31
- t.index ["history_started_at"], name: "index_author_histories_on_history_started_at"
32
- t.index ["history_user_id"], name: "index_author_histories_on_history_user_id"
33
- end
34
-
35
- create_table "authors", force: :cascade do |t|
36
- t.string "full_name", null: false
37
- t.text "bio"
38
- t.datetime "deleted_at"
39
- t.datetime "created_at", null: false
40
- t.datetime "updated_at", null: false
41
- t.index ["deleted_at"], name: "index_authors_on_deleted_at"
42
- end
43
-
44
- create_table "post_histories", force: :cascade do |t|
45
- t.integer "post_id", null: false
46
- t.string "title", null: false
47
- t.text "body", null: false
48
- t.integer "author_id", null: false
49
- t.boolean "enabled", default: false
50
- t.datetime "live_at"
51
- t.datetime "deleted_at"
52
- t.datetime "created_at", null: false
53
- t.datetime "updated_at", null: false
54
- t.datetime "history_started_at", null: false
55
- t.datetime "history_ended_at"
56
- t.integer "history_user_id"
57
- t.index ["author_id"], name: "index_post_histories_on_author_id"
58
- t.index ["deleted_at"], name: "index_post_histories_on_deleted_at"
59
- t.index ["enabled"], name: "index_post_histories_on_enabled"
60
- t.index ["history_ended_at"], name: "index_post_histories_on_history_ended_at"
61
- t.index ["history_started_at"], name: "index_post_histories_on_history_started_at"
62
- t.index ["history_user_id"], name: "index_post_histories_on_history_user_id"
63
- t.index ["live_at"], name: "index_post_histories_on_live_at"
64
- t.index ["post_id"], name: "index_post_histories_on_post_id"
65
- end
66
-
67
- create_table "posts", force: :cascade do |t|
68
- t.string "title", null: false
69
- t.text "body", null: false
70
- t.integer "author_id", null: false
71
- t.boolean "enabled", default: false
72
- t.datetime "live_at"
73
- t.datetime "deleted_at"
74
- t.datetime "created_at", null: false
75
- t.datetime "updated_at", null: false
76
- t.index ["author_id"], name: "index_posts_on_author_id"
77
- t.index ["deleted_at"], name: "index_posts_on_deleted_at"
78
- t.index ["enabled"], name: "index_posts_on_enabled"
79
- t.index ["live_at"], name: "index_posts_on_live_at"
80
- end
81
-
82
- create_table "safe_post_histories", force: :cascade do |t|
83
- t.integer "safe_post_id", null: false
84
- t.string "title", null: false
85
- t.text "body", null: false
86
- t.integer "author_id", null: false
87
- t.boolean "enabled", default: false
88
- t.datetime "live_at"
89
- t.datetime "deleted_at"
90
- t.datetime "created_at", null: false
91
- t.datetime "updated_at", null: false
92
- t.datetime "history_started_at", null: false
93
- t.datetime "history_ended_at"
94
- t.integer "history_user_id"
95
- t.index ["author_id"], name: "index_safe_post_histories_on_author_id"
96
- t.index ["deleted_at"], name: "index_safe_post_histories_on_deleted_at"
97
- t.index ["enabled"], name: "index_safe_post_histories_on_enabled"
98
- t.index ["history_ended_at"], name: "index_safe_post_histories_on_history_ended_at"
99
- t.index ["history_started_at"], name: "index_safe_post_histories_on_history_started_at"
100
- t.index ["history_user_id"], name: "index_safe_post_histories_on_history_user_id"
101
- t.index ["live_at"], name: "index_safe_post_histories_on_live_at"
102
- t.index ["safe_post_id"], name: "index_safe_post_histories_on_safe_post_id"
103
- end
104
-
105
- create_table "safe_posts", force: :cascade do |t|
106
- t.string "title", null: false
107
- t.text "body", null: false
108
- t.integer "author_id", null: false
109
- t.boolean "enabled", default: false
110
- t.datetime "live_at"
111
- t.datetime "deleted_at"
112
- t.datetime "created_at", null: false
113
- t.datetime "updated_at", null: false
114
- t.index ["author_id"], name: "index_safe_posts_on_author_id"
115
- t.index ["deleted_at"], name: "index_safe_posts_on_deleted_at"
116
- t.index ["enabled"], name: "index_safe_posts_on_enabled"
117
- t.index ["live_at"], name: "index_safe_posts_on_live_at"
118
- end
119
-
120
- create_table "silent_post_histories", force: :cascade do |t|
121
- t.integer "silent_post_id", null: false
122
- t.string "title", null: false
123
- t.text "body", null: false
124
- t.integer "author_id", null: false
125
- t.boolean "enabled", default: false
126
- t.datetime "live_at"
127
- t.datetime "deleted_at"
128
- t.datetime "created_at", null: false
129
- t.datetime "updated_at", null: false
130
- t.datetime "history_started_at", null: false
131
- t.datetime "history_ended_at"
132
- t.integer "history_user_id"
133
- t.index ["author_id"], name: "index_silent_post_histories_on_author_id"
134
- t.index ["deleted_at"], name: "index_silent_post_histories_on_deleted_at"
135
- t.index ["enabled"], name: "index_silent_post_histories_on_enabled"
136
- t.index ["history_ended_at"], name: "index_silent_post_histories_on_history_ended_at"
137
- t.index ["history_started_at"], name: "index_silent_post_histories_on_history_started_at"
138
- t.index ["history_user_id"], name: "index_silent_post_histories_on_history_user_id"
139
- t.index ["live_at"], name: "index_silent_post_histories_on_live_at"
140
- t.index ["silent_post_id"], name: "index_silent_post_histories_on_silent_post_id"
141
- end
142
-
143
- create_table "silent_posts", force: :cascade do |t|
144
- t.string "title", null: false
145
- t.text "body", null: false
146
- t.integer "author_id", null: false
147
- t.boolean "enabled", default: false
148
- t.datetime "live_at"
149
- t.datetime "deleted_at"
150
- t.datetime "created_at", null: false
151
- t.datetime "updated_at", null: false
152
- t.index ["author_id"], name: "index_silent_posts_on_author_id"
153
- t.index ["deleted_at"], name: "index_silent_posts_on_deleted_at"
154
- t.index ["enabled"], name: "index_silent_posts_on_enabled"
155
- t.index ["live_at"], name: "index_silent_posts_on_live_at"
156
- end
157
-
158
- create_table "thing_with_compound_index_histories", force: :cascade do |t|
159
- t.integer "thing_with_compound_index_id", null: false
160
- t.string "key"
161
- t.string "value"
162
- t.datetime "history_started_at", null: false
163
- t.datetime "history_ended_at"
164
- t.integer "history_user_id"
165
- t.index ["history_ended_at"], name: "index_thing_with_compound_index_histories_on_history_ended_at"
166
- t.index ["history_started_at"], name: "index_thing_with_compound_index_histories_on_history_started_at"
167
- t.index ["history_user_id"], name: "index_thing_with_compound_index_histories_on_history_user_id"
168
- t.index ["key", "value"], name: "idx_history_k_v"
169
- t.index ["thing_with_compound_index_id"], name: "idx_k_v_histories"
170
- end
171
-
172
- create_table "thing_with_compound_indices", force: :cascade do |t|
173
- t.string "key"
174
- t.string "value"
175
- t.index ["key", "value"], name: "idx_key_value"
176
- end
177
-
178
- create_table "thing_without_histories", force: :cascade do |t|
179
- t.string "name"
180
- end
181
-
182
- create_table "users", force: :cascade do |t|
183
- t.string "name"
184
- end
185
-
186
- end
data/spec/examples.txt DELETED
@@ -1,32 +0,0 @@
1
- example_id | status | run_time |
2
- ----------------------------------------- | ------ | --------------- |
3
- ./spec/historiographer_spec.rb[1:1:1] | passed | 0.05541 seconds |
4
- ./spec/historiographer_spec.rb[1:1:2] | passed | 0.04942 seconds |
5
- ./spec/historiographer_spec.rb[1:1:3] | passed | 0.02648 seconds |
6
- ./spec/historiographer_spec.rb[1:2:1] | passed | 0.03832 seconds |
7
- ./spec/historiographer_spec.rb[1:2:2] | passed | 0.00076 seconds |
8
- ./spec/historiographer_spec.rb[1:2:3:1:1] | passed | 0.04672 seconds |
9
- ./spec/historiographer_spec.rb[1:2:3:1:2] | passed | 0.01971 seconds |
10
- ./spec/historiographer_spec.rb[1:2:3:2:1] | passed | 0.12226 seconds |
11
- ./spec/historiographer_spec.rb[1:2:3:2:2] | passed | 0.09424 seconds |
12
- ./spec/historiographer_spec.rb[1:2:3:2:3] | passed | 0.05644 seconds |
13
- ./spec/historiographer_spec.rb[1:2:3:3:1] | passed | 0.16536 seconds |
14
- ./spec/historiographer_spec.rb[1:2:3:3:2] | passed | 0.01638 seconds |
15
- ./spec/historiographer_spec.rb[1:2:4:1] | passed | 0.00552 seconds |
16
- ./spec/historiographer_spec.rb[1:2:4:2] | passed | 0.01095 seconds |
17
- ./spec/historiographer_spec.rb[1:2:4:3] | passed | 0.0022 seconds |
18
- ./spec/historiographer_spec.rb[1:2:5:1] | passed | 0.08367 seconds |
19
- ./spec/historiographer_spec.rb[1:2:5:2] | passed | 0.10781 seconds |
20
- ./spec/historiographer_spec.rb[1:2:5:3] | passed | 0.00516 seconds |
21
- ./spec/historiographer_spec.rb[1:2:6] | passed | 0.00482 seconds |
22
- ./spec/historiographer_spec.rb[1:2:7] | passed | 0.00642 seconds |
23
- ./spec/historiographer_spec.rb[1:2:8] | passed | 0.00926 seconds |
24
- ./spec/historiographer_spec.rb[1:3:1] | passed | 0.01607 seconds |
25
- ./spec/historiographer_spec.rb[1:4:1] | passed | 0.03777 seconds |
26
- ./spec/historiographer_spec.rb[1:5:1] | passed | 0.04254 seconds |
27
- ./spec/historiographer_spec.rb[1:5:2] | passed | 0.02652 seconds |
28
- ./spec/historiographer_spec.rb[1:6:1] | passed | 0.23851 seconds |
29
- ./spec/historiographer_spec.rb[1:6:2] | passed | 0.16412 seconds |
30
- ./spec/historiographer_spec.rb[1:7:1] | passed | 0.07495 seconds |
31
- ./spec/historiographer_spec.rb[1:8:1] | passed | 0.02917 seconds |
32
- ./spec/historiographer_spec.rb[1:9:1] | passed | 0.0228 seconds |
@@ -1,7 +0,0 @@
1
- FactoryBot.define do
2
- factory :post do
3
- sequence(:title) { |n| "Post #{n}"}
4
- body { "The body of the post" }
5
- author_id { 1 }
6
- end
7
- end