18874: Merge commit '6f8dcb2b13f3058db656908fb26b09e23b527f08' into 18874-merge-wb2
[arvados.git] / services / api / db / migrate / 20130123180228_create_api_client_authorizations.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class CreateApiClientAuthorizations < ActiveRecord::Migration[4.2]
6   def change
7     create_table :api_client_authorizations do |t|
8       t.string :api_token, :null => false
9       t.references :api_client, :null => false
10       t.references :user, :null => false
11       t.string :created_by_ip_address
12       t.string :last_used_by_ip_address
13       t.datetime :last_used_at
14       t.datetime :expires_at
15
16       t.timestamps
17     end
18     add_index :api_client_authorizations, :api_token, :unique => true
19     add_index :api_client_authorizations, :api_client_id
20     add_index :api_client_authorizations, :user_id
21     add_index :api_client_authorizations, :expires_at
22   end
23 end