add anon session

This commit is contained in:
gowthaman.b 2024-01-05 12:17:16 +05:30
parent 2be4df0b6d
commit 81afbdab49
2 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,27 @@
-- apply changes
create table anon_session (
sys_pk bigint generated by default as identity not null,
deleted_on timestamp,
current_approval_level integer default 0 not null,
required_approval_levels integer default 0 not null,
first_seen_at timestamp,
last_seen_at timestamp,
deleted boolean default false not null,
version integer default 1 not null,
created_at timestamp default 'now()' not null,
modified_at timestamp default 'now()' not null,
deleted_by varchar(255),
approval_status varchar(8) default 'APPROVED' not null,
tags varchar[] default '{}' not null,
comments jsonb default '[]' not null,
tenant_id varchar(255) not null,
session_id varchar(255),
ip varchar(255),
header_map jsonb not null,
created_by varchar(255) not null,
modified_by varchar(255) not null,
constraint ck_anon_session_approval_status check ( approval_status in ('PENDING','APPROVED','REJECTED')),
constraint unique_session_id unique (session_id),
constraint pk_anon_session primary key (sys_pk)
);

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<migration xmlns="http://ebean-orm.github.io/xml/ns/dbmigration">
<changeSet type="apply">
<createTable name="anon_session" pkName="pk_anon_session">
<column name="sys_pk" type="bigint" primaryKey="true"/>
<column name="deleted_on" type="localdatetime"/>
<column name="deleted_by" type="varchar"/>
<column name="current_approval_level" type="integer" defaultValue="0" notnull="true"/>
<column name="required_approval_levels" type="integer" defaultValue="0" notnull="true"/>
<column name="approval_status" type="varchar(8)" defaultValue="'APPROVED'" notnull="true" checkConstraint="check ( approval_status in ('PENDING','APPROVED','REJECTED'))" checkConstraintName="ck_anon_session_approval_status"/>
<column name="tags" type="varchar[]" defaultValue="'{}'" notnull="true"/>
<column name="comments" type="jsonb" defaultValue="'[]'" notnull="true"/>
<column name="tenant_id" type="varchar" notnull="true"/>
<column name="session_id" type="varchar"/>
<column name="ip" type="varchar"/>
<column name="first_seen_at" type="localdatetime"/>
<column name="last_seen_at" type="localdatetime"/>
<column name="header_map" type="jsonb" notnull="true"/>
<column name="deleted" type="boolean" defaultValue="false" notnull="true"/>
<column name="version" type="integer" defaultValue="1" notnull="true"/>
<column name="created_at" type="localdatetime" defaultValue="'now()'" notnull="true"/>
<column name="modified_at" type="localdatetime" defaultValue="'now()'" notnull="true"/>
<column name="created_by" type="varchar" notnull="true"/>
<column name="modified_by" type="varchar" notnull="true"/>
<uniqueConstraint name="unique_session_id" columnNames="session_id" oneToOne="false" nullableColumns="session_id"/>
</createTable>
</changeSet>
</migration>