diff options
| author | realtradam <[email protected]> | 2020-12-02 19:26:28 -0500 |
|---|---|---|
| committer | realtradam <[email protected]> | 2020-12-02 19:26:28 -0500 |
| commit | d13b636bd654244f894943c2968a7386e8379605 (patch) | |
| tree | 410809bae61eac943e1af19ecfd2c2f31143c796 /db/migrate | |
| download | rails-tree-style-activerecord-d13b636bd654244f894943c2968a7386e8379605.tar.gz rails-tree-style-activerecord-d13b636bd654244f894943c2968a7386e8379605.zip | |
initial
Diffstat (limited to 'db/migrate')
| -rw-r--r-- | db/migrate/20201202192548_create_nodes.rb | 11 | ||||
| -rw-r--r-- | db/migrate/20201202230939_add_node_id_to_nodes.rb | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/db/migrate/20201202192548_create_nodes.rb b/db/migrate/20201202192548_create_nodes.rb new file mode 100644 index 0000000..903bb67 --- /dev/null +++ b/db/migrate/20201202192548_create_nodes.rb @@ -0,0 +1,11 @@ +class CreateNodes < ActiveRecord::Migration[6.0] + def change + create_table :nodes do |t| + t.string :title + t.text :content + t.references :parent, index: true + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20201202230939_add_node_id_to_nodes.rb b/db/migrate/20201202230939_add_node_id_to_nodes.rb new file mode 100644 index 0000000..484bb8e --- /dev/null +++ b/db/migrate/20201202230939_add_node_id_to_nodes.rb @@ -0,0 +1,5 @@ +class AddNodeIdToNodes < ActiveRecord::Migration[6.0] + def change + add_column :nodes, :node_id, :integer + end +end |
