File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ -- +micrate Up
2+ -- SQL in section 'Up' is executed when this migration is applied
3+
4+ -- Table created by rails migration:
5+ -- class CreateDoorkeeperOpenidConnectTables < ActiveRecord::Migration[8.1]
6+ -- create_table :oauth_openid_requests do |t|
7+ -- t.references :access_grant, null: false, index: true
8+ -- t.string :nonce, null: false
9+ -- end
10+ -- add_foreign_key :oauth_openid_requests, :oauth_access_grants,
11+ -- column: :access_grant_id, on_delete: :cascade
12+ -- end
13+
14+ CREATE TABLE IF NOT EXISTS oauth_openid_requests (
15+ id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,
16+ access_grant_id BIGINT NOT NULL ,
17+ nonce TEXT NOT NULL
18+ );
19+
20+ -- index that Rails would add for t.references ... index: true
21+ CREATE INDEX IF NOT EXISTS idx_oauth_openid_requests_on_access_grant_id
22+ ON oauth_openid_requests (access_grant_id);
23+
24+ -- foreign key with ON DELETE CASCADE
25+ ALTER TABLE oauth_openid_requests
26+ ADD CONSTRAINT fk_oauth_openid_requests_access_grant
27+ FOREIGN KEY (access_grant_id)
28+ REFERENCES oauth_access_grants (id)
29+ ON DELETE CASCADE ;
30+
31+ -- +micrate Down
32+ -- SQL section 'Down' is executed when this migration is rolled back
33+
34+ DROP TABLE IF EXISTS oauth_openid_requests;
You can’t perform that action at this time.
0 commit comments