diff options
Diffstat (limited to 'db/migrate/20260714233414_create_node_actions.rb')
| -rw-r--r-- | db/migrate/20260714233414_create_node_actions.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20260714233414_create_node_actions.rb b/db/migrate/20260714233414_create_node_actions.rb new file mode 100644 index 0000000..6c18285 --- /dev/null +++ b/db/migrate/20260714233414_create_node_actions.rb | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | class CreateNodeActions < ActiveRecord::Migration[8.1] | ||
| 2 | def change | ||
| 3 | create_table :node_actions do |t| | ||
| 4 | t.references :node, foreign_key: { on_delete: :nullify } | ||
| 5 | t.references :page, foreign_key: { on_delete: :nullify } | ||
| 6 | t.references :user, foreign_key: { on_delete: :nullify } | ||
| 7 | t.string :action, null: false | ||
| 8 | t.string :locale | ||
| 9 | t.string :inferred_from | ||
| 10 | t.jsonb :metadata, null: false | ||
| 11 | t.datetime :occurred_at, null: false | ||
| 12 | |||
| 13 | t.timestamps | ||
| 14 | end | ||
| 15 | |||
| 16 | add_index :node_actions, [:node_id, :occurred_at] | ||
| 17 | add_index :node_actions, :action | ||
| 18 | end | ||
| 19 | end | ||
