auth method schema (#131)
* Rename iam migrations to 06 * Add base tables for auth methods and auth accounts * Add triggers for auth_method and auth_account subtypes
This commit is contained in:
1 parent
ed60cac7fe
commit
0ebb38bbe5
6 files changed
+247
-4
No files matched your search
@@ -332,8 +332,68 @@ commit;
|
||||
|
||||
`),
|
||||
},
|
||||
"migrations/04_iam.down.sql": {
|
||||
name: "04_iam.down.sql",
|
||||
"migrations/04_auth.down.sql": {
|
||||
name: "04_auth.down.sql",
|
||||
bytes: []byte(`
|
||||
begin;
|
||||
|
||||
drop function insert_auth_account_subtype;
|
||||
drop function insert_auth_method_subtype;
|
||||
|
||||
drop table auth_account cascade;
|
||||
drop table auth_method cascade;
|
||||
|
||||
commit;
|
||||
|
||||
`),
|
||||
},
|
||||
"migrations/04_auth.up.sql": {
|
||||
name: "04_auth.up.sql",
|
||||
bytes: []byte(`
|
||||
begin;
|
||||
|
||||
-- base table for auth methods
|
||||
create table auth_method (
|
||||
auth_method_id wt_public_id primary key
|
||||
);
|
||||
|
||||
|
||||
-- base table for auth accounts
|
||||
create table auth_account (
|
||||
auth_account_id wt_public_id primary key
|
||||
);
|
||||
|
||||
|
||||
create or replace function
|
||||
insert_auth_method_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
insert into auth_method (auth_method_id)
|
||||
values
|
||||
(new.auth_method_id);
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
create or replace function
|
||||
insert_auth_account_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
insert into auth_account (auth_account_id)
|
||||
values
|
||||
(new.auth_account_id);
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
commit;
|
||||
|
||||
`),
|
||||
},
|
||||
"migrations/06_iam.down.sql": {
|
||||
name: "06_iam.down.sql",
|
||||
bytes: []byte(`
|
||||
BEGIN;
|
||||
|
||||
@@ -354,8 +414,8 @@ COMMIT;
|
||||
|
||||
`),
|
||||
},
|
||||
"migrations/04_iam.up.sql": {
|
||||
name: "04_iam.up.sql",
|
||||
"migrations/06_iam.up.sql": {
|
||||
name: "06_iam.up.sql",
|
||||
bytes: []byte(`
|
||||
begin;
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
begin;
|
||||
|
||||
drop function insert_auth_account_subtype;
|
||||
drop function insert_auth_method_subtype;
|
||||
|
||||
drop table auth_account cascade;
|
||||
drop table auth_method cascade;
|
||||
|
||||
commit;
|
||||
@@ -0,0 +1,39 @@
|
||||
begin;
|
||||
|
||||
-- base table for auth methods
|
||||
create table auth_method (
|
||||
auth_method_id wt_public_id primary key
|
||||
);
|
||||
|
||||
|
||||
-- base table for auth accounts
|
||||
create table auth_account (
|
||||
auth_account_id wt_public_id primary key
|
||||
);
|
||||
|
||||
|
||||
create or replace function
|
||||
insert_auth_method_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
insert into auth_method (auth_method_id)
|
||||
values
|
||||
(new.auth_method_id);
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
create or replace function
|
||||
insert_auth_account_subtype()
|
||||
returns trigger
|
||||
as $$
|
||||
begin
|
||||
insert into auth_account (auth_account_id)
|
||||
values
|
||||
(new.auth_account_id);
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
|
||||
commit;
|
||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user