Skip to content

Commit 4d3a056

Browse files
committed
feat: add openid connect table
1 parent 44d3159 commit 4d3a056

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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;

0 commit comments

Comments
 (0)