Skip to content

Commit

Permalink
Merge pull request #48 from shreelakshmijoshi/adding-immudb-schema
Browse files Browse the repository at this point in the history
Add immudb schema
  • Loading branch information
pranavrd authored Apr 15, 2024
2 parents fc4dd11 + 1d8f77d commit 9faa965
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions src/main/resources/immudb/migration/V1_1__init-tables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
--- creating immudb audit tables
---


---
--- auditing_dmp
---
CREATE TABLE auditing_dmp(_id VARCHAR[128] NOT NULL,user_id VARCHAR[128] NOT NULL,api VARCHAR[128] NOT NULL,method VARCHAR[32] NOT NULL,info VARCHAR[1024] NOT NULL, epoch_time INTEGER NOT NULL, iso_time VARCHAR[64] NOT NULL, PRIMARY KEY _id);


---
--- auditing_consent
---
create table auditing_consent (_id varchar[128] not null,item_id varchar[256] not null,item_type varchar[128] not null,event varchar[256] not null,aiu_id varchar[128] not null,aip_id varchar[256] not null,dp_id varchar[128] not null,isotime varchar[128] not null,artifact varchar[128] not null,shalog varchar[2046] not null,primary key _id);
---
--- auditing_acl_apd
-- This is not the current schema used in Dev instance of immudb, to create
-- this schema, data from the old table could be migrated here
---
CREATE TABLE auditing_acl_apd(id VARCHAR[256] NOT NULL, userid VARCHAR[128] NOT NULL,endpoint VARCHAR[128] NOT NULL,method VARCHAR[128] NOT NULL,body VARCHAR[2048] NOT NULL,size INTEGER NOT NULL,isotime VARCHAR[128] NOT NULL,epochtime INTEGER NOT NULL,PRIMARY KEY id);

---
--- rsaudit
---
CREATE TABLE rsaudit (id VARCHAR[128] PRIMARY KEY, api VARCHAR[128] NOT NULL, userid VARCHAR[128] NOT NULL, epochtime INTEGER NOT NULL, resourceid VARCHAR[256] NOT NULL, isotime VARCHAR[64] NOT NULL, providerid VARCHAR[128] NOT NULL, size INTEGER);

---
--- auditingtable
---
CREATE TABLE auditingtable (id VARCHAR[128] PRIMARY KEY, userrole VARCHAR[64] NOT NULL, userid VARCHAR[128] NOT NULL, iid VARCHAR[250] NOT NULL, api VARCHAR[128] NOT NULL, method VARCHAR[32] NOT NULL, time INTEGER NOT NULL, iudxid VARCHAR[256] NOT NULL);


---
--- creating index for the tables
---

---
--- auditing_dmp
---
CREATE INDEX IF NOT EXISTS ON auditing_dmp(api, method, user_id, epoch_time);

---
--- auditing_acl_apd
---
CREATE INDEX IF NOT EXISTS ON auditing_acl(endpoint, method, userid, epochtime);

---
--- rsaudit
---
CREATE INDEX IF NOT EXISTS index_name ON rsaudit(userid, providerid);


---
--- auditingtable
---
CREATE INDEX IF NOT EXISTS index_name ON auditingtable(userid, api);

---
--- auditing_consent
---
CREATE INDEX IF NOT EXISTS ON auditing_consent(item_id, aiu_id, dp_id);

0 comments on commit 9faa965

Please sign in to comment.