prompt --application/deployment/install/install_chatbot_tables
begin
--   Manifest
--     INSTALL: INSTALL-Chatbot Tables
--   Manifest End
wwv_flow_imp.component_begin (
 p_version_yyyy_mm_dd=>'2024.05.31'
,p_release=>'24.1.2'
,p_default_workspace_id=>5893639279394007
,p_default_application_id=>20011
,p_default_id_offset=>0
,p_default_owner=>'DEMO'
);
wwv_flow_imp_shared.create_install_script(
 p_id=>wwv_flow_imp.id(16011846141376651)
,p_install_id=>wwv_flow_imp.id(16009640173256284)
,p_name=>'Chatbot Tables'
,p_sequence=>10
,p_script_type=>'INSTALL'
,p_script_clob=>wwv_flow_string.join(wwv_flow_t_varchar2(
'  CREATE TABLE "CB_CHAT_MESSAGES" ',
'   (	"MESSAGE_ID" NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, ',
'	"CHAT_ID" NUMBER NOT NULL ENABLE, ',
'	"MESSAGE_TIME" TIMESTAMP (6) WITH LOCAL TIME ZONE DEFAULT LOCALTIMESTAMP NOT NULL ENABLE, ',
'	"MESSAGE_TYPE" VARCHAR2(1 CHAR) NOT NULL ENABLE, ',
'	"USER_NAME" VARCHAR2(240 CHAR) NOT NULL ENABLE, ',
'	"MESSAGE_TEXT" CLOB, ',
'	"ATTACHMENT" BLOB, ',
'	"CREATED_BY" VARCHAR2(240 CHAR) NOT NULL ENABLE, ',
'	"CREATION_DATE" TIMESTAMP (6) WITH LOCAL TIME ZONE DEFAULT LOCALTIMESTAMP NOT NULL ENABLE, ',
'	"LAST_UPDATED_BY" VARCHAR2(240 CHAR) NOT NULL ENABLE, ',
'	"LAST_UPDATE_DATE" TIMESTAMP (6) WITH LOCAL TIME ZONE DEFAULT LOCALTIMESTAMP NOT NULL ENABLE, ',
'	 CONSTRAINT "CB_CHAT_MESSAGES_PK" PRIMARY KEY ("MESSAGE_ID")',
'  USING INDEX  ENABLE',
'   ) ;',
'',
'  CREATE TABLE "CB_CHATS" ',
'   (	"CHAT_ID" NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, ',
'	"CHAT_NAME" VARCHAR2(240 CHAR) DEFAULT ''Untitled Conversation'' NOT NULL ENABLE, ',
'	"MODEL_ID" NUMBER NOT NULL ENABLE, ',
'	"CHAT_START_DATE" TIMESTAMP (6) WITH LOCAL TIME ZONE NOT NULL ENABLE, ',
'	"CREATED_BY" VARCHAR2(240 CHAR) NOT NULL ENABLE, ',
'	"CREATION_DATE" TIMESTAMP (6) WITH LOCAL TIME ZONE DEFAULT LOCALTIMESTAMP NOT NULL ENABLE, ',
'	"LAST_UPDATED_BY" VARCHAR2(240 CHAR) NOT NULL ENABLE, ',
'	"LAST_UPDATE_DATE" TIMESTAMP (6) WITH LOCAL TIME ZONE DEFAULT LOCALTIMESTAMP NOT NULL ENABLE, ',
'	 CONSTRAINT "CB_CHATS_PK" PRIMARY KEY ("CHAT_ID")',
'  USING INDEX  ENABLE',
'   ) ;',
'',
'  CREATE TABLE "CB_MODELS" ',
'   (	"MODEL_ID" NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, ',
'	"MODEL_NAME" VARCHAR2(240 CHAR) NOT NULL ENABLE, ',
'	"MODEL_DESCRIPTION" VARCHAR2(4000 CHAR), ',
'	"VENDOR_ID" NUMBER, ',
'	"LAUNCH_DATE" DATE, ',
'	"OFFICIAL_WEBSITE" VARCHAR2(4000 CHAR), ',
'	"FREE_OF_CHARGE" VARCHAR2(1 CHAR), ',
'	"PRICE_PER_UNIT" NUMBER, ',
'	"PRICE_UOM" VARCHAR2(240 CHAR), ',
'	"PRICE_CURRENCY" VARCHAR2(30 CHAR), ',
'	"TOKEN_LIMIT" VARCHAR2(4000 CHAR), ',
'	"CREATED_BY" VARCHAR2(240 CHAR) NOT NULL ENABLE, ',
'	"CREATION_DATE" TIMESTAMP (6) WITH LOCAL TIME ZONE DEFAULT LOCALTIMESTAMP NOT NULL ENABLE, ',
'	"LAST_UPDATED_BY" VARCHAR2(240 CHAR) NOT NULL ENABLE, ',
'	"LAST_UPDATE_DATE" TIMESTAMP (6) WITH LOCAL TIME ZONE DEFAULT LOCALTIMESTAMP NOT NULL ENABLE, ',
'	"READY_FOR_CHAT" VARCHAR2(1) DEFAULT ''N'', ',
'	 CONSTRAINT "CB_MODELS_PK" PRIMARY KEY ("MODEL_ID")',
'  USING INDEX  ENABLE',
'   ) ;',
'',
'  CREATE TABLE "CB_VENDORS" ',
'   (	"VENDOR_ID" NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, ',
'	"VENDOR_NAME" VARCHAR2(240 CHAR) NOT NULL ENABLE, ',
'	"VENDOR_DESCRIPTION" VARCHAR2(4000 CHAR), ',
'	"OFFICIAL_WEBSITE" VARCHAR2(4000 CHAR), ',
'	"CREATED_BY" VARCHAR2(240 CHAR) NOT NULL ENABLE, ',
'	"CREATION_DATE" TIMESTAMP (6) WITH LOCAL TIME ZONE DEFAULT LOCALTIMESTAMP NOT NULL ENABLE, ',
'	"LAST_UPDATED_BY" VARCHAR2(240 CHAR) NOT NULL ENABLE, ',
'	"LAST_UPDATE_DATE" TIMESTAMP (6) WITH LOCAL TIME ZONE DEFAULT LOCALTIMESTAMP NOT NULL ENABLE, ',
'	 CONSTRAINT "CB_VENDORS_PK" PRIMARY KEY ("VENDOR_ID")',
'  USING INDEX  ENABLE',
'   ) ;',
'',
'   COMMENT ON TABLE "CB_CHATS"  IS ''Chat Bot Conversation'';',
'',
'  ALTER TABLE "CB_CHAT_MESSAGES" ADD CONSTRAINT "CB_CHAT_MESSAGES_CON" FOREIGN KEY ("CHAT_ID")',
'	  REFERENCES "CB_CHATS" ("CHAT_ID") ENABLE;',
'',
'   COMMENT ON COLUMN "CB_CHAT_MESSAGES"."MESSAGE_TYPE" IS ''U: User; M: Model'';',
'   COMMENT ON TABLE "CB_CHAT_MESSAGES"  IS ''Chat Box Chat Detail'';',
'',
'   COMMENT ON TABLE "CB_MODELS"  IS ''Chat Bot Models'';',
'',
'   COMMENT ON TABLE "CB_VENDORS"  IS ''Chat Bot Vendors''; '))
);
wwv_flow_imp_shared.create_install_object(
 p_id=>wwv_flow_imp.id(16011955718376706)
,p_script_id=>wwv_flow_imp.id(16011846141376651)
,p_object_owner=>'#OWNER#'
,p_object_type=>'TABLE'
,p_object_name=>'CB_CHATS'
);
wwv_flow_imp_shared.create_install_object(
 p_id=>wwv_flow_imp.id(16012012950376711)
,p_script_id=>wwv_flow_imp.id(16011846141376651)
,p_object_owner=>'#OWNER#'
,p_object_type=>'TABLE'
,p_object_name=>'CB_CHAT_MESSAGES'
);
wwv_flow_imp_shared.create_install_object(
 p_id=>wwv_flow_imp.id(16012262546376715)
,p_script_id=>wwv_flow_imp.id(16011846141376651)
,p_object_owner=>'#OWNER#'
,p_object_type=>'TABLE'
,p_object_name=>'CB_MODELS'
);
wwv_flow_imp_shared.create_install_object(
 p_id=>wwv_flow_imp.id(16012403937376716)
,p_script_id=>wwv_flow_imp.id(16011846141376651)
,p_object_owner=>'#OWNER#'
,p_object_type=>'TABLE'
,p_object_name=>'CB_VENDORS'
);
wwv_flow_imp.component_end;
end;
/
