historiographer 4.1.14 → 4.1.16

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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/.document +5 -0
  3. data/.rspec +1 -0
  4. data/.ruby-version +1 -0
  5. data/.standalone_migrations +6 -0
  6. data/Gemfile +33 -0
  7. data/Gemfile.lock +341 -0
  8. data/Guardfile +4 -0
  9. data/Rakefile +54 -0
  10. data/VERSION +1 -0
  11. data/historiographer-4.1.12.gem +0 -0
  12. data/historiographer-4.1.13.gem +0 -0
  13. data/historiographer-4.1.14.gem +0 -0
  14. data/historiographer.gemspec +144 -0
  15. data/init.rb +18 -0
  16. data/instructions/implementation.md +282 -0
  17. data/instructions/todo.md +96 -0
  18. data/lib/historiographer/history.rb +1 -7
  19. data/lib/historiographer/version.rb +1 -1
  20. data/spec/db/database.yml +27 -0
  21. data/spec/db/migrate/20161121212228_create_posts.rb +19 -0
  22. data/spec/db/migrate/20161121212229_create_post_histories.rb +10 -0
  23. data/spec/db/migrate/20161121212230_create_authors.rb +13 -0
  24. data/spec/db/migrate/20161121212231_create_author_histories.rb +10 -0
  25. data/spec/db/migrate/20161121212232_create_users.rb +9 -0
  26. data/spec/db/migrate/20171011194624_create_safe_posts.rb +19 -0
  27. data/spec/db/migrate/20171011194715_create_safe_post_histories.rb +9 -0
  28. data/spec/db/migrate/20191024142304_create_thing_with_compound_index.rb +10 -0
  29. data/spec/db/migrate/20191024142352_create_thing_with_compound_index_history.rb +11 -0
  30. data/spec/db/migrate/20191024203106_create_thing_without_history.rb +7 -0
  31. data/spec/db/migrate/20221018204220_create_silent_posts.rb +21 -0
  32. data/spec/db/migrate/20221018204255_create_silent_post_histories.rb +9 -0
  33. data/spec/db/migrate/20241109182017_create_comments.rb +13 -0
  34. data/spec/db/migrate/20241109182020_create_comment_histories.rb +9 -0
  35. data/spec/db/migrate/20241118000000_add_type_to_posts.rb +6 -0
  36. data/spec/db/migrate/20241118000001_add_type_to_post_histories.rb +5 -0
  37. data/spec/db/migrate/20241118000002_create_ml_models.rb +19 -0
  38. data/spec/db/migrate/20241118000003_create_easy_ml_columns.rb +17 -0
  39. data/spec/db/migrate/20241119000000_create_datasets.rb +17 -0
  40. data/spec/db/schema.rb +308 -0
  41. data/spec/factories/post.rb +7 -0
  42. data/spec/historiographer_spec.rb +918 -0
  43. data/spec/models/application_record.rb +3 -0
  44. data/spec/models/author.rb +5 -0
  45. data/spec/models/author_history.rb +4 -0
  46. data/spec/models/comment.rb +5 -0
  47. data/spec/models/comment_history.rb +5 -0
  48. data/spec/models/dataset.rb +6 -0
  49. data/spec/models/dataset_history.rb +4 -0
  50. data/spec/models/easy_ml/column.rb +7 -0
  51. data/spec/models/easy_ml/column_history.rb +6 -0
  52. data/spec/models/easy_ml/encrypted_column.rb +10 -0
  53. data/spec/models/easy_ml/encrypted_column_history.rb +6 -0
  54. data/spec/models/ml_model.rb +6 -0
  55. data/spec/models/ml_model_history.rb +4 -0
  56. data/spec/models/post.rb +45 -0
  57. data/spec/models/post_history.rb +8 -0
  58. data/spec/models/private_post.rb +12 -0
  59. data/spec/models/private_post_history.rb +4 -0
  60. data/spec/models/safe_post.rb +5 -0
  61. data/spec/models/safe_post_history.rb +5 -0
  62. data/spec/models/silent_post.rb +3 -0
  63. data/spec/models/silent_post_history.rb +4 -0
  64. data/spec/models/thing_with_compound_index.rb +3 -0
  65. data/spec/models/thing_with_compound_index_history.rb +4 -0
  66. data/spec/models/thing_without_history.rb +2 -0
  67. data/spec/models/user.rb +2 -0
  68. data/spec/models/xgboost.rb +10 -0
  69. data/spec/models/xgboost_history.rb +4 -0
  70. data/spec/spec_helper.rb +105 -0
  71. metadata +70 -31
@@ -0,0 +1,17 @@
1
+ require 'historiographer/postgres_migration'
2
+
3
+ class CreateDatasets < ActiveRecord::Migration[7.1]
4
+ def change
5
+ create_table :datasets do |t|
6
+ t.string :name, null: false
7
+ t.bigint :ml_model_id
8
+ t.timestamps
9
+
10
+ t.index :ml_model_id
11
+ end
12
+
13
+ create_table :dataset_histories do |t|
14
+ t.histories
15
+ end
16
+ end
17
+ end
data/spec/db/schema.rb ADDED
@@ -0,0 +1,308 @@
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[7.1].define(version: 2024_11_19_000000) do
14
+ # These are extensions that must be enabled in order to support this database
15
+ enable_extension "plpgsql"
16
+
17
+ create_table "author_histories", force: :cascade do |t|
18
+ t.integer "author_id", null: false
19
+ t.string "full_name", null: false
20
+ t.text "bio"
21
+ t.datetime "deleted_at", precision: nil
22
+ t.datetime "created_at", precision: nil, null: false
23
+ t.datetime "updated_at", precision: nil, null: false
24
+ t.datetime "history_started_at", precision: nil, null: false
25
+ t.datetime "history_ended_at", precision: nil
26
+ t.integer "history_user_id"
27
+ t.string "snapshot_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
+ t.index ["snapshot_id"], name: "index_author_histories_on_snapshot_id"
34
+ end
35
+
36
+ create_table "authors", force: :cascade do |t|
37
+ t.string "full_name", null: false
38
+ t.text "bio"
39
+ t.datetime "deleted_at", precision: nil
40
+ t.datetime "created_at", precision: nil, null: false
41
+ t.datetime "updated_at", precision: nil, null: false
42
+ t.index ["deleted_at"], name: "index_authors_on_deleted_at"
43
+ end
44
+
45
+ create_table "comment_histories", force: :cascade do |t|
46
+ t.integer "comment_id", null: false
47
+ t.integer "post_id"
48
+ t.integer "author_id"
49
+ t.text "body"
50
+ t.datetime "created_at", null: false
51
+ t.datetime "updated_at", null: false
52
+ t.datetime "history_started_at", null: false
53
+ t.datetime "history_ended_at"
54
+ t.integer "history_user_id"
55
+ t.string "snapshot_id"
56
+ t.index ["author_id"], name: "index_comment_histories_on_author_id"
57
+ t.index ["comment_id"], name: "index_comment_histories_on_comment_id"
58
+ t.index ["history_ended_at"], name: "index_comment_histories_on_history_ended_at"
59
+ t.index ["history_started_at"], name: "index_comment_histories_on_history_started_at"
60
+ t.index ["history_user_id"], name: "index_comment_histories_on_history_user_id"
61
+ t.index ["post_id"], name: "index_comment_histories_on_post_id"
62
+ t.index ["snapshot_id"], name: "index_comment_histories_on_snapshot_id"
63
+ end
64
+
65
+ create_table "comments", force: :cascade do |t|
66
+ t.bigint "post_id"
67
+ t.bigint "author_id"
68
+ t.text "body"
69
+ t.datetime "created_at", null: false
70
+ t.datetime "updated_at", null: false
71
+ t.index ["author_id"], name: "index_comments_on_author_id"
72
+ t.index ["post_id"], name: "index_comments_on_post_id"
73
+ end
74
+
75
+ create_table "dataset_histories", force: :cascade do |t|
76
+ t.integer "dataset_id", null: false
77
+ t.string "name", null: false
78
+ t.integer "ml_model_id"
79
+ t.datetime "created_at", null: false
80
+ t.datetime "updated_at", null: false
81
+ t.datetime "history_started_at", null: false
82
+ t.datetime "history_ended_at"
83
+ t.integer "history_user_id"
84
+ t.string "snapshot_id"
85
+ t.index ["dataset_id"], name: "index_dataset_histories_on_dataset_id"
86
+ t.index ["history_ended_at"], name: "index_dataset_histories_on_history_ended_at"
87
+ t.index ["history_started_at"], name: "index_dataset_histories_on_history_started_at"
88
+ t.index ["history_user_id"], name: "index_dataset_histories_on_history_user_id"
89
+ t.index ["ml_model_id"], name: "index_dataset_histories_on_ml_model_id"
90
+ t.index ["snapshot_id"], name: "index_dataset_histories_on_snapshot_id"
91
+ end
92
+
93
+ create_table "datasets", force: :cascade do |t|
94
+ t.string "name", null: false
95
+ t.bigint "ml_model_id"
96
+ t.datetime "created_at", null: false
97
+ t.datetime "updated_at", null: false
98
+ t.index ["ml_model_id"], name: "index_datasets_on_ml_model_id"
99
+ end
100
+
101
+ create_table "easy_ml_column_histories", force: :cascade do |t|
102
+ t.integer "column_id", null: false
103
+ t.string "name", null: false
104
+ t.string "data_type", null: false
105
+ t.string "column_type"
106
+ t.datetime "created_at", null: false
107
+ t.datetime "updated_at", null: false
108
+ t.datetime "history_started_at", null: false
109
+ t.datetime "history_ended_at"
110
+ t.integer "history_user_id"
111
+ t.string "snapshot_id"
112
+ t.index ["column_id"], name: "index_easy_ml_column_histories_on_column_id"
113
+ t.index ["history_ended_at"], name: "index_easy_ml_column_histories_on_history_ended_at"
114
+ t.index ["history_started_at"], name: "index_easy_ml_column_histories_on_history_started_at"
115
+ t.index ["history_user_id"], name: "index_easy_ml_column_histories_on_history_user_id"
116
+ t.index ["snapshot_id"], name: "index_easy_ml_column_histories_on_snapshot_id"
117
+ end
118
+
119
+ create_table "easy_ml_columns", force: :cascade do |t|
120
+ t.string "name", null: false
121
+ t.string "data_type", null: false
122
+ t.string "column_type"
123
+ t.datetime "created_at", null: false
124
+ t.datetime "updated_at", null: false
125
+ end
126
+
127
+ create_table "ml_model_histories", force: :cascade do |t|
128
+ t.integer "ml_model_id", null: false
129
+ t.string "name"
130
+ t.string "model_type"
131
+ t.jsonb "parameters"
132
+ t.datetime "created_at", null: false
133
+ t.datetime "updated_at", null: false
134
+ t.datetime "history_started_at", null: false
135
+ t.datetime "history_ended_at"
136
+ t.integer "history_user_id"
137
+ t.string "snapshot_id"
138
+ t.index ["history_ended_at"], name: "index_ml_model_histories_on_history_ended_at"
139
+ t.index ["history_started_at"], name: "index_ml_model_histories_on_history_started_at"
140
+ t.index ["history_user_id"], name: "index_ml_model_histories_on_history_user_id"
141
+ t.index ["ml_model_id"], name: "index_ml_model_histories_on_ml_model_id"
142
+ t.index ["model_type"], name: "index_ml_model_histories_on_model_type"
143
+ t.index ["snapshot_id"], name: "index_ml_model_histories_on_snapshot_id"
144
+ end
145
+
146
+ create_table "ml_models", force: :cascade do |t|
147
+ t.string "name"
148
+ t.string "model_type"
149
+ t.jsonb "parameters"
150
+ t.datetime "created_at", null: false
151
+ t.datetime "updated_at", null: false
152
+ t.index ["model_type"], name: "index_ml_models_on_model_type"
153
+ end
154
+
155
+ create_table "post_histories", force: :cascade do |t|
156
+ t.integer "post_id", null: false
157
+ t.string "title", null: false
158
+ t.text "body", null: false
159
+ t.integer "author_id", null: false
160
+ t.boolean "enabled", default: false
161
+ t.datetime "live_at", precision: nil
162
+ t.datetime "deleted_at", precision: nil
163
+ t.datetime "created_at", precision: nil, null: false
164
+ t.datetime "updated_at", precision: nil, null: false
165
+ t.datetime "history_started_at", precision: nil, null: false
166
+ t.datetime "history_ended_at", precision: nil
167
+ t.integer "history_user_id"
168
+ t.string "snapshot_id"
169
+ t.string "type"
170
+ t.index ["author_id"], name: "index_post_histories_on_author_id"
171
+ t.index ["deleted_at"], name: "index_post_histories_on_deleted_at"
172
+ t.index ["enabled"], name: "index_post_histories_on_enabled"
173
+ t.index ["history_ended_at"], name: "index_post_histories_on_history_ended_at"
174
+ t.index ["history_started_at"], name: "index_post_histories_on_history_started_at"
175
+ t.index ["history_user_id"], name: "index_post_histories_on_history_user_id"
176
+ t.index ["live_at"], name: "index_post_histories_on_live_at"
177
+ t.index ["post_id"], name: "index_post_histories_on_post_id"
178
+ t.index ["snapshot_id"], name: "index_post_histories_on_snapshot_id"
179
+ end
180
+
181
+ create_table "posts", force: :cascade do |t|
182
+ t.string "title", null: false
183
+ t.text "body", null: false
184
+ t.integer "author_id", null: false
185
+ t.boolean "enabled", default: false
186
+ t.datetime "live_at", precision: nil
187
+ t.datetime "deleted_at", precision: nil
188
+ t.datetime "created_at", precision: nil, null: false
189
+ t.datetime "updated_at", precision: nil, null: false
190
+ t.string "type"
191
+ t.index ["author_id"], name: "index_posts_on_author_id"
192
+ t.index ["deleted_at"], name: "index_posts_on_deleted_at"
193
+ t.index ["enabled"], name: "index_posts_on_enabled"
194
+ t.index ["live_at"], name: "index_posts_on_live_at"
195
+ t.index ["type"], name: "index_posts_on_type"
196
+ end
197
+
198
+ create_table "safe_post_histories", force: :cascade do |t|
199
+ t.integer "safe_post_id", null: false
200
+ t.string "title", null: false
201
+ t.text "body", null: false
202
+ t.integer "author_id", null: false
203
+ t.boolean "enabled", default: false
204
+ t.datetime "live_at", precision: nil
205
+ t.datetime "deleted_at", precision: nil
206
+ t.datetime "created_at", precision: nil, null: false
207
+ t.datetime "updated_at", precision: nil, null: false
208
+ t.datetime "history_started_at", precision: nil, null: false
209
+ t.datetime "history_ended_at", precision: nil
210
+ t.integer "history_user_id"
211
+ t.string "snapshot_id"
212
+ t.index ["author_id"], name: "index_safe_post_histories_on_author_id"
213
+ t.index ["deleted_at"], name: "index_safe_post_histories_on_deleted_at"
214
+ t.index ["enabled"], name: "index_safe_post_histories_on_enabled"
215
+ t.index ["history_ended_at"], name: "index_safe_post_histories_on_history_ended_at"
216
+ t.index ["history_started_at"], name: "index_safe_post_histories_on_history_started_at"
217
+ t.index ["history_user_id"], name: "index_safe_post_histories_on_history_user_id"
218
+ t.index ["live_at"], name: "index_safe_post_histories_on_live_at"
219
+ t.index ["safe_post_id"], name: "index_safe_post_histories_on_safe_post_id"
220
+ t.index ["snapshot_id"], name: "index_safe_post_histories_on_snapshot_id"
221
+ end
222
+
223
+ create_table "safe_posts", force: :cascade do |t|
224
+ t.string "title", null: false
225
+ t.text "body", null: false
226
+ t.integer "author_id", null: false
227
+ t.boolean "enabled", default: false
228
+ t.datetime "live_at", precision: nil
229
+ t.datetime "deleted_at", precision: nil
230
+ t.datetime "created_at", precision: nil, null: false
231
+ t.datetime "updated_at", precision: nil, null: false
232
+ t.index ["author_id"], name: "index_safe_posts_on_author_id"
233
+ t.index ["deleted_at"], name: "index_safe_posts_on_deleted_at"
234
+ t.index ["enabled"], name: "index_safe_posts_on_enabled"
235
+ t.index ["live_at"], name: "index_safe_posts_on_live_at"
236
+ end
237
+
238
+ create_table "silent_post_histories", force: :cascade do |t|
239
+ t.integer "silent_post_id", null: false
240
+ t.string "title", null: false
241
+ t.text "body", null: false
242
+ t.integer "author_id", null: false
243
+ t.boolean "enabled", default: false
244
+ t.datetime "live_at", precision: nil
245
+ t.datetime "deleted_at", precision: nil
246
+ t.datetime "created_at", precision: nil, null: false
247
+ t.datetime "updated_at", precision: nil, null: false
248
+ t.datetime "history_started_at", precision: nil, null: false
249
+ t.datetime "history_ended_at", precision: nil
250
+ t.integer "history_user_id"
251
+ t.string "snapshot_id"
252
+ t.index ["author_id"], name: "index_silent_post_histories_on_author_id"
253
+ t.index ["deleted_at"], name: "index_silent_post_histories_on_deleted_at"
254
+ t.index ["enabled"], name: "index_silent_post_histories_on_enabled"
255
+ t.index ["history_ended_at"], name: "index_silent_post_histories_on_history_ended_at"
256
+ t.index ["history_started_at"], name: "index_silent_post_histories_on_history_started_at"
257
+ t.index ["history_user_id"], name: "index_silent_post_histories_on_history_user_id"
258
+ t.index ["live_at"], name: "index_silent_post_histories_on_live_at"
259
+ t.index ["silent_post_id"], name: "index_silent_post_histories_on_silent_post_id"
260
+ t.index ["snapshot_id"], name: "index_silent_post_histories_on_snapshot_id"
261
+ end
262
+
263
+ create_table "silent_posts", force: :cascade do |t|
264
+ t.string "title", null: false
265
+ t.text "body", null: false
266
+ t.integer "author_id", null: false
267
+ t.boolean "enabled", default: false
268
+ t.datetime "live_at", precision: nil
269
+ t.datetime "deleted_at", precision: nil
270
+ t.datetime "created_at", precision: nil, null: false
271
+ t.datetime "updated_at", precision: nil, null: false
272
+ t.index ["author_id"], name: "index_silent_posts_on_author_id"
273
+ t.index ["deleted_at"], name: "index_silent_posts_on_deleted_at"
274
+ t.index ["enabled"], name: "index_silent_posts_on_enabled"
275
+ t.index ["live_at"], name: "index_silent_posts_on_live_at"
276
+ end
277
+
278
+ create_table "thing_with_compound_index_histories", force: :cascade do |t|
279
+ t.integer "thing_with_compound_index_id", null: false
280
+ t.string "key"
281
+ t.string "value"
282
+ t.datetime "history_started_at", precision: nil, null: false
283
+ t.datetime "history_ended_at", precision: nil
284
+ t.integer "history_user_id"
285
+ t.string "snapshot_id"
286
+ t.index ["history_ended_at"], name: "index_thing_with_compound_index_histories_on_history_ended_at"
287
+ t.index ["history_started_at"], name: "index_thing_with_compound_index_histories_on_history_started_at"
288
+ t.index ["history_user_id"], name: "index_thing_with_compound_index_histories_on_history_user_id"
289
+ t.index ["key", "value"], name: "idx_history_k_v"
290
+ t.index ["snapshot_id"], name: "index_thing_with_compound_index_histories_on_snapshot_id"
291
+ t.index ["thing_with_compound_index_id"], name: "idx_k_v_histories"
292
+ end
293
+
294
+ create_table "thing_with_compound_indices", force: :cascade do |t|
295
+ t.string "key"
296
+ t.string "value"
297
+ t.index ["key", "value"], name: "idx_key_value"
298
+ end
299
+
300
+ create_table "thing_without_histories", force: :cascade do |t|
301
+ t.string "name"
302
+ end
303
+
304
+ create_table "users", force: :cascade do |t|
305
+ t.string "name"
306
+ end
307
+
308
+ end
@@ -0,0 +1,7 @@
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