main
rb 20 lines 861 Bytes
Raw
1 class CreateGithubAppInstallations < ActiveRecord::Migration[8.1]
2 def change
3 create_table :github_app_installations do |t|
4 t.bigint :installation_id, null: false # GitHub's installation id
5 t.string :account_login, null: false # org/user the app is installed on
6 t.string :account_type # "User" | "Organization"
7 t.bigint :account_id
8 t.string :repository_selection # "all" | "selected"
9 t.datetime :suspended_at
10 t.datetime :deleted_at # soft delete on installation.deleted
11 t.string :access_token # cached installation token (expires within 1h)
12 t.datetime :access_token_expires_at
13
14 t.timestamps
15 end
16
17 add_index :github_app_installations, :installation_id, unique: true
18 add_index :github_app_installations, :account_login
19 end
20 end