| 1 | class CreatePullRequests < ActiveRecord::Migration[8.1] |
| 2 | def change |
| 3 | create_table :pull_requests do |t| |
| 4 | t.references :repository, null: false, foreign_key: true |
| 5 | t.references :user, null: false, foreign_key: true # author |
| 6 | t.integer :number, null: false |
| 7 | t.string :title, null: false |
| 8 | t.text :body |
| 9 | t.string :state, null: false, default: "open" |
| 10 | t.string :head_ref, null: false |
| 11 | t.string :base_ref, null: false |
| 12 | t.datetime :merged_at |
| 13 | |
| 14 | t.timestamps |
| 15 | end |
| 16 | |
| 17 | add_index :pull_requests, [ :repository_id, :number ], unique: true |
| 18 | end |
| 19 | end |