historiographer 4.1.14 → 4.3.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.
Files changed (65) 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/README.md +0 -168
  10. data/Rakefile +54 -0
  11. data/VERSION +1 -0
  12. data/historiographer-4.1.12.gem +0 -0
  13. data/historiographer-4.1.13.gem +0 -0
  14. data/historiographer-4.1.14.gem +0 -0
  15. data/historiographer.gemspec +136 -0
  16. data/init.rb +18 -0
  17. data/instructions/implementation.md +282 -0
  18. data/instructions/todo.md +96 -0
  19. data/lib/historiographer/history.rb +1 -20
  20. data/lib/historiographer/version.rb +1 -1
  21. data/lib/historiographer.rb +27 -14
  22. data/spec/db/database.yml +27 -0
  23. data/spec/db/migrate/20161121212228_create_posts.rb +19 -0
  24. data/spec/db/migrate/20161121212229_create_post_histories.rb +10 -0
  25. data/spec/db/migrate/20161121212230_create_authors.rb +13 -0
  26. data/spec/db/migrate/20161121212231_create_author_histories.rb +10 -0
  27. data/spec/db/migrate/20161121212232_create_users.rb +9 -0
  28. data/spec/db/migrate/20171011194624_create_safe_posts.rb +19 -0
  29. data/spec/db/migrate/20171011194715_create_safe_post_histories.rb +9 -0
  30. data/spec/db/migrate/20191024142304_create_thing_with_compound_index.rb +10 -0
  31. data/spec/db/migrate/20191024142352_create_thing_with_compound_index_history.rb +11 -0
  32. data/spec/db/migrate/20191024203106_create_thing_without_history.rb +7 -0
  33. data/spec/db/migrate/20221018204220_create_silent_posts.rb +21 -0
  34. data/spec/db/migrate/20221018204255_create_silent_post_histories.rb +9 -0
  35. data/spec/db/migrate/20241109182017_create_comments.rb +13 -0
  36. data/spec/db/migrate/20241109182020_create_comment_histories.rb +9 -0
  37. data/spec/db/migrate/20241119000000_create_datasets.rb +17 -0
  38. data/spec/db/migrate/2025082100000_create_projects.rb +14 -0
  39. data/spec/db/migrate/2025082100001_create_project_files.rb +18 -0
  40. data/spec/db/schema.rb +352 -0
  41. data/spec/factories/post.rb +7 -0
  42. data/spec/historiographer_spec.rb +920 -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/easy_ml/column.rb +6 -0
  49. data/spec/models/easy_ml/column_history.rb +6 -0
  50. data/spec/models/post.rb +45 -0
  51. data/spec/models/post_history.rb +8 -0
  52. data/spec/models/project.rb +4 -0
  53. data/spec/models/project_file.rb +5 -0
  54. data/spec/models/project_file_history.rb +4 -0
  55. data/spec/models/project_history.rb +4 -0
  56. data/spec/models/safe_post.rb +5 -0
  57. data/spec/models/safe_post_history.rb +5 -0
  58. data/spec/models/silent_post.rb +3 -0
  59. data/spec/models/silent_post_history.rb +4 -0
  60. data/spec/models/thing_with_compound_index.rb +3 -0
  61. data/spec/models/thing_with_compound_index_history.rb +4 -0
  62. data/spec/models/thing_without_history.rb +2 -0
  63. data/spec/models/user.rb +2 -0
  64. data/spec/spec_helper.rb +105 -0
  65. metadata +62 -31
@@ -0,0 +1,27 @@
1
+ development:
2
+ adapter: postgresql
3
+ encoding: unicode
4
+ database: historiographer_development
5
+ pool: 5
6
+
7
+ test:
8
+ adapter: postgresql
9
+ encoding: unicode
10
+ database: historiographer_test
11
+ pool: 5
12
+
13
+ # mysql_default: &mysql_default
14
+ # adapter: mysql2
15
+ # encoding: utf8
16
+ # username: root
17
+ # password:
18
+ # host: 127.0.0.1
19
+ # port: 3306
20
+
21
+ # development:
22
+ # <<: *mysql_default
23
+ # database: historiographer_development
24
+
25
+ # test:
26
+ # <<: *mysql_default
27
+ # database: historiographer_test
@@ -0,0 +1,19 @@
1
+ class CreatePosts < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :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 :posts, :author_id
15
+ add_index :posts, :enabled
16
+ add_index :posts, :live_at
17
+ add_index :posts, :deleted_at
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ require "historiographer/postgres_migration"
2
+ require "historiographer/mysql_migration"
3
+
4
+ class CreatePostHistories < ActiveRecord::Migration[5.1]
5
+ def change
6
+ create_table :post_histories do |t|
7
+ t.histories
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ class CreateAuthors < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :authors do |t|
4
+ t.string :full_name, null: false
5
+ t.text :bio
6
+ t.datetime :deleted_at
7
+
8
+ t.timestamps
9
+ end
10
+
11
+ add_index :authors, :deleted_at
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ require "historiographer/postgres_migration"
2
+ require "historiographer/mysql_migration"
3
+
4
+ class CreateAuthorHistories < ActiveRecord::Migration[5.1]
5
+ def change
6
+ create_table :author_histories do |t|
7
+ t.histories
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ require "historiographer/postgres_migration"
2
+
3
+ class CreateUsers < ActiveRecord::Migration[5.1]
4
+ def change
5
+ create_table :users do |t|
6
+ t.string :name
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
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
@@ -0,0 +1,9 @@
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
@@ -0,0 +1,10 @@
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
@@ -0,0 +1,11 @@
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
@@ -0,0 +1,7 @@
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
@@ -0,0 +1,21 @@
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
@@ -0,0 +1,9 @@
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
@@ -0,0 +1,13 @@
1
+ class CreateComments < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :comments do |t|
4
+ t.bigint :post_id
5
+ t.bigint :author_id
6
+ t.text :body
7
+ t.timestamps
8
+
9
+ t.index :post_id
10
+ t.index :author_id
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ require 'historiographer/postgres_migration'
2
+
3
+ class CreateCommentHistories < ActiveRecord::Migration[7.1]
4
+ def change
5
+ create_table :comment_histories do |t|
6
+ t.histories
7
+ end
8
+ end
9
+ end
@@ -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
@@ -0,0 +1,14 @@
1
+ require 'historiographer/postgres_migration'
2
+
3
+ class CreateProjects < ActiveRecord::Migration[7.1]
4
+ def change
5
+ create_table :projects do |t|
6
+ t.string :name, null: false
7
+ t.timestamps
8
+ end
9
+
10
+ create_table :project_histories do |t|
11
+ t.histories
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+
2
+ require 'historiographer/postgres_migration'
3
+
4
+ class CreateProjectFiles < ActiveRecord::Migration[7.1]
5
+ def change
6
+ create_table :project_files do |t|
7
+ t.bigint :project_id
8
+ t.string :name, null: false
9
+ t.string :content
10
+ t.timestamps
11
+ t.index :project_id
12
+ end
13
+
14
+ create_table :project_file_histories do |t|
15
+ t.histories
16
+ end
17
+ end
18
+ end
data/spec/db/schema.rb ADDED
@@ -0,0 +1,352 @@
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 "project_file_histories", force: :cascade do |t|
199
+ t.integer "project_file_id", null: false
200
+ t.string "name", null: false
201
+ t.datetime "created_at", null: false
202
+ t.datetime "updated_at", null: false
203
+ t.datetime "history_started_at", null: false
204
+ t.datetime "history_ended_at"
205
+ t.integer "history_user_id"
206
+ t.string "snapshot_id"
207
+ t.index ["history_ended_at"], name: "index_project_file_histories_on_history_ended_at"
208
+ t.index ["history_started_at"], name: "index_project_file_histories_on_history_started_at"
209
+ t.index ["history_user_id"], name: "index_project_file_histories_on_history_user_id"
210
+ t.index ["project_file_id"], name: "index_project_file_histories_on_project_file_id"
211
+ t.index ["snapshot_id"], name: "index_project_file_histories_on_snapshot_id"
212
+ end
213
+
214
+ create_table "project_files", force: :cascade do |t|
215
+ t.string "name", null: false
216
+ t.datetime "created_at", null: false
217
+ t.datetime "updated_at", null: false
218
+ end
219
+
220
+ create_table "project_histories", force: :cascade do |t|
221
+ t.integer "project_id", null: false
222
+ t.string "name", null: false
223
+ t.datetime "created_at", null: false
224
+ t.datetime "updated_at", null: false
225
+ t.datetime "history_started_at", null: false
226
+ t.datetime "history_ended_at"
227
+ t.integer "history_user_id"
228
+ t.string "snapshot_id"
229
+ t.index ["history_ended_at"], name: "index_project_histories_on_history_ended_at"
230
+ t.index ["history_started_at"], name: "index_project_histories_on_history_started_at"
231
+ t.index ["history_user_id"], name: "index_project_histories_on_history_user_id"
232
+ t.index ["project_id"], name: "index_project_histories_on_project_id"
233
+ t.index ["snapshot_id"], name: "index_project_histories_on_snapshot_id"
234
+ end
235
+
236
+ create_table "projects", force: :cascade do |t|
237
+ t.string "name", null: false
238
+ t.datetime "created_at", null: false
239
+ t.datetime "updated_at", null: false
240
+ end
241
+
242
+ create_table "safe_post_histories", force: :cascade do |t|
243
+ t.integer "safe_post_id", null: false
244
+ t.string "title", null: false
245
+ t.text "body", null: false
246
+ t.integer "author_id", null: false
247
+ t.boolean "enabled", default: false
248
+ t.datetime "live_at", precision: nil
249
+ t.datetime "deleted_at", precision: nil
250
+ t.datetime "created_at", precision: nil, null: false
251
+ t.datetime "updated_at", precision: nil, null: false
252
+ t.datetime "history_started_at", precision: nil, null: false
253
+ t.datetime "history_ended_at", precision: nil
254
+ t.integer "history_user_id"
255
+ t.string "snapshot_id"
256
+ t.index ["author_id"], name: "index_safe_post_histories_on_author_id"
257
+ t.index ["deleted_at"], name: "index_safe_post_histories_on_deleted_at"
258
+ t.index ["enabled"], name: "index_safe_post_histories_on_enabled"
259
+ t.index ["history_ended_at"], name: "index_safe_post_histories_on_history_ended_at"
260
+ t.index ["history_started_at"], name: "index_safe_post_histories_on_history_started_at"
261
+ t.index ["history_user_id"], name: "index_safe_post_histories_on_history_user_id"
262
+ t.index ["live_at"], name: "index_safe_post_histories_on_live_at"
263
+ t.index ["safe_post_id"], name: "index_safe_post_histories_on_safe_post_id"
264
+ t.index ["snapshot_id"], name: "index_safe_post_histories_on_snapshot_id"
265
+ end
266
+
267
+ create_table "safe_posts", force: :cascade do |t|
268
+ t.string "title", null: false
269
+ t.text "body", null: false
270
+ t.integer "author_id", null: false
271
+ t.boolean "enabled", default: false
272
+ t.datetime "live_at", precision: nil
273
+ t.datetime "deleted_at", precision: nil
274
+ t.datetime "created_at", precision: nil, null: false
275
+ t.datetime "updated_at", precision: nil, null: false
276
+ t.index ["author_id"], name: "index_safe_posts_on_author_id"
277
+ t.index ["deleted_at"], name: "index_safe_posts_on_deleted_at"
278
+ t.index ["enabled"], name: "index_safe_posts_on_enabled"
279
+ t.index ["live_at"], name: "index_safe_posts_on_live_at"
280
+ end
281
+
282
+ create_table "silent_post_histories", force: :cascade do |t|
283
+ t.integer "silent_post_id", null: false
284
+ t.string "title", null: false
285
+ t.text "body", null: false
286
+ t.integer "author_id", null: false
287
+ t.boolean "enabled", default: false
288
+ t.datetime "live_at", precision: nil
289
+ t.datetime "deleted_at", precision: nil
290
+ t.datetime "created_at", precision: nil, null: false
291
+ t.datetime "updated_at", precision: nil, null: false
292
+ t.datetime "history_started_at", precision: nil, null: false
293
+ t.datetime "history_ended_at", precision: nil
294
+ t.integer "history_user_id"
295
+ t.string "snapshot_id"
296
+ t.index ["author_id"], name: "index_silent_post_histories_on_author_id"
297
+ t.index ["deleted_at"], name: "index_silent_post_histories_on_deleted_at"
298
+ t.index ["enabled"], name: "index_silent_post_histories_on_enabled"
299
+ t.index ["history_ended_at"], name: "index_silent_post_histories_on_history_ended_at"
300
+ t.index ["history_started_at"], name: "index_silent_post_histories_on_history_started_at"
301
+ t.index ["history_user_id"], name: "index_silent_post_histories_on_history_user_id"
302
+ t.index ["live_at"], name: "index_silent_post_histories_on_live_at"
303
+ t.index ["silent_post_id"], name: "index_silent_post_histories_on_silent_post_id"
304
+ t.index ["snapshot_id"], name: "index_silent_post_histories_on_snapshot_id"
305
+ end
306
+
307
+ create_table "silent_posts", force: :cascade do |t|
308
+ t.string "title", null: false
309
+ t.text "body", null: false
310
+ t.integer "author_id", null: false
311
+ t.boolean "enabled", default: false
312
+ t.datetime "live_at", precision: nil
313
+ t.datetime "deleted_at", precision: nil
314
+ t.datetime "created_at", precision: nil, null: false
315
+ t.datetime "updated_at", precision: nil, null: false
316
+ t.index ["author_id"], name: "index_silent_posts_on_author_id"
317
+ t.index ["deleted_at"], name: "index_silent_posts_on_deleted_at"
318
+ t.index ["enabled"], name: "index_silent_posts_on_enabled"
319
+ t.index ["live_at"], name: "index_silent_posts_on_live_at"
320
+ end
321
+
322
+ create_table "thing_with_compound_index_histories", force: :cascade do |t|
323
+ t.integer "thing_with_compound_index_id", null: false
324
+ t.string "key"
325
+ t.string "value"
326
+ t.datetime "history_started_at", precision: nil, null: false
327
+ t.datetime "history_ended_at", precision: nil
328
+ t.integer "history_user_id"
329
+ t.string "snapshot_id"
330
+ t.index ["history_ended_at"], name: "index_thing_with_compound_index_histories_on_history_ended_at"
331
+ t.index ["history_started_at"], name: "index_thing_with_compound_index_histories_on_history_started_at"
332
+ t.index ["history_user_id"], name: "index_thing_with_compound_index_histories_on_history_user_id"
333
+ t.index ["key", "value"], name: "idx_history_k_v"
334
+ t.index ["snapshot_id"], name: "index_thing_with_compound_index_histories_on_snapshot_id"
335
+ t.index ["thing_with_compound_index_id"], name: "idx_k_v_histories"
336
+ end
337
+
338
+ create_table "thing_with_compound_indices", force: :cascade do |t|
339
+ t.string "key"
340
+ t.string "value"
341
+ t.index ["key", "value"], name: "idx_key_value"
342
+ end
343
+
344
+ create_table "thing_without_histories", force: :cascade do |t|
345
+ t.string "name"
346
+ end
347
+
348
+ create_table "users", force: :cascade do |t|
349
+ t.string "name"
350
+ end
351
+
352
+ 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