Class: CreatePosts

Inherits:
Object
  • Object
show all
Defined in:
lib/db/migrate/20230227135020_create_posts.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/db/migrate/20230227135020_create_posts.rb', line 2

def change
  create_table :posts do |t|
    t.string :title 
    t.text :content 
    t.bigint :author_id, null: false
    t.datetime :deleted_at

    t.timestamps
  end

  add_index :posts, :author_id, unique: true
  add_index :posts, :deleted_at, unique: true
end