Skip to content

Instantly share code, notes, and snippets.

@renuka-fernando
Last active September 2, 2020 05:12
Show Gist options
  • Save renuka-fernando/b57cea07bd660cab722238dbe698175f to your computer and use it in GitHub Desktop.
Save renuka-fernando/b57cea07bd660cab722238dbe698175f to your computer and use it in GitHub Desktop.
WSO2AM-operator-configs.yaml
#Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# WSO2 Inc. licenses this file to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file except
# in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
apiVersion: v1
kind: Namespace
metadata:
name: wso2-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: wso2am-pattern-1-svc-account
namespace : wso2-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: wso2am-controller-role
rules:
- apiGroups:
- apps
resources:
- deployments
verbs:
- get
- list
- create
- update
- delete
- patch
- watch
- apiGroups:
- ""
resources:
- pods
- namespaces
- secrets
- events
- services
- serviceaccounts
- configmaps
- persistentvolumeclaims
- ingresses
verbs:
- get
- list
- create
- update
- delete
- patch
- watch
- apiGroups:
- monitoring.coreos.com
resources:
- servicemonitors
verbs:
- get
- create
- apiGroups:
- extensions
resources:
- ingresses
verbs:
- get
- list
- create
- update
- delete
- patch
- watch
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- get
- list
- create
- update
- delete
- patch
- watch
- apiGroups:
- apim.wso2.com
resources:
- apimanagers
- apimanagers/finalizers
verbs:
- get
- list
- create
- update
- delete
- patch
- watch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: wso2am-controller-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: wso2am-controller-role
subjects:
- kind: ServiceAccount
name: wso2am-pattern-1-svc-account
namespace: wso2-system
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: apimanagers.apim.wso2.com
spec:
group: apim.wso2.com
version: v1alpha1
names:
kind: APIManager
plural: apimanagers
subresources:
status: {}
scope: Namespaced
additionalPrinterColumns:
- name: Type
type: string
description: Type of this component
JSONPath: .status.componentType
- name: Status
type: string
description: Status of this component
JSONPath: .status.status
- name: Service-Name
type: string
description: Service name of this component
JSONPath: .status.serviceName
- name: Ready-Replicas
type: integer
description: Number of replicas available for this component
JSONPath: .status.availableReplicas
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: wso2am-controller
namespace: wso2-system
spec:
replicas: 1
selector:
matchLabels:
app: wso2am-controller
template:
metadata:
labels:
app: wso2am-controller
spec:
containers:
- name: wso2am-controller
image: wso2/k8s-wso2am-operator:1.1.0
imagePullPolicy: Always
serviceAccountName: wso2am-pattern-1-svc-account
---
apiVersion: v1
kind: ConfigMap
metadata:
name: wso2am-operator-controller-config
namespace: wso2-system
data:
api-manager-version: "3.2.0"
image-pull-secret-name: ""
service-account-name: ""
# common configs for apim-instances
apim-deployment-replicas: "1"
apim-deployment-minReadySeconds: "240"
apim-deployment-maxSurge: "1"
apim-deployment-maxUnavailable: "0"
apim-deployment-imagePullPolicy: "Always"
apim-deployment-livenessProbe-initialDelaySeconds: "120"
apim-deployment-livenessProbe-periodSeconds: "10"
apim-deployment-livenessProbe-failureThreshold: "3"
apim-deployment-readinessProbe-initialDelaySeconds: "120"
apim-deployment-readinessProbe-periodSeconds: "10"
apim-deployment-readinessProbe-failureThreshold: "3"
# common configs for apim-analytics
apim-analytics-deployment-replicas: "1"
apim-analytics-deployment-minReadySeconds: "30"
apim-analytics-deployment-maxSurge: "1"
apim-analytics-deployment-maxUnavailable: "0"
apim-analytics-deployment-imagePullPolicy: "Always"
apim-analytics-deployment-livenessProbe-initialDelaySeconds: "20"
apim-analytics-deployment-livenessProbe-periodSeconds: "10"
apim-analytics-deployment-livenessProbe-failureThreshold: "3"
apim-analytics-deployment-readinessProbe-initialDelaySeconds: "20"
apim-analytics-deployment-readinessProbe-periodSeconds: "10"
apim-analytics-deployment-readinessProbe-failureThreshold: "3"
# pattern specific configs for apim-instances
p1-apim-deployment-image: "wso2/wso2am:3.2.0"
p1-apim-deployment-resources-requests-cpu: "2000m"
p1-apim-deployment-resources-requests-memory: "2Gi"
p1-apim-deployment-resources-limits-cpu: "2000m"
p1-apim-deployment-resources-limits-memory: "2Gi"
# custom pattern specific configs for apim-instances
pX-apim-deployment-image: "wso2/wso2am:3.2.0"
pX-apim-deployment-resources-requests-cpu: "2000m"
pX-apim-deployment-resources-requests-memory: "2Gi"
pX-apim-deployment-resources-limits-cpu: "2000m"
pX-apim-deployment-resources-limits-memory: "2Gi"
# pattern specific configs for apim-analytics
p1-apim-analytics-deployment-dashboard-image: "wso2/wso2am-analytics-dashboard:3.2.0"
p1-apim-analytics-deployment-worker-image: "wso2/wso2am-analytics-worker:3.2.0"
p1-apim-analytics-deployment-resources-requests-cpu: "2000m"
p1-apim-analytics-deployment-resources-requests-memory: "4Gi"
p1-apim-analytics-deployment-resources-limits-cpu: "2000m"
p1-apim-analytics-deployment-resources-limits-memory: "4Gi"
# custom pattern specific configs for apim-analytics
pX-apim-analytics-deployment-dashboard-image: "wso2/wso2am-analytics-dashboard:3.2.0"
pX-apim-analytics-deployment-worker-image: "wso2/wso2am-analytics-worker:3.2.0"
pX-apim-analytics-deployment-resources-requests-cpu: "2000m"
pX-apim-analytics-deployment-resources-requests-memory: "4Gi"
pX-apim-analytics-deployment-resources-limits-cpu: "2000m"
pX-apim-analytics-deployment-resources-limits-memory: "4Gi"
mysql-replicas: "1"
mysql-image: "mysql:5.7"
mysql-imagePullPolicy: "IfNotPresent"
---
kind: ConfigMap
apiVersion: v1
metadata:
name: pvc-config
namespace: wso2-system
data:
wso2amP1SynapseConfigsPvcName: "wso2am-p1-am-synapse-configs"
wso2amP1ExecutionPlansPvcName: "wso2am-p1-am-execution-plans"
wso2amMysqlPvcName: "wso2am-mysql"
wso2amPvcAccessmode: "ReadWriteMany"
wso2amPvcSynapseConfigsStorage: "1Gi"
wso2amPvcExecutionPlansStorage: "1Gi"
wso2amPvcMysqlStorage: "20Gi"
# for internal-nfs-server-provisioner
# provisioning-type: internal-nfs
storageClassName: "nfs"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: wso2am-p1-analytics-dash-bin
namespace: wso2-system
data:
carbon.sh: |-
#!/bin/sh
# ---------------------------------------------------------------------------
# Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------
# Main Script for the WSO2 Carbon Server
#
# Environment Variable Prequisites
#
# CARBON_HOME Home of WSO2 Carbon installation. If not set I will try
# to figure it out.
# RUNTIME_HOME Home of WSO2 Carbon Runtime. .
#
# JAVA_HOME Must point at your Java Development Kit installation.
#
# JAVA_OPTS (Optional) Java runtime options used when the commands
# is executed.
#
# NOTE: Borrowed generously from Apache Tomcat startup scripts.
# -----------------------------------------------------------------------------
# OS specific support. $var _must_ be set to either true or false.
#ulimit -n 100000
cygwin=false;
darwin=false;
os400=false;
mingw=false;
case "`uname`" in
CYGWIN*) cygwin=true;;
MINGW*) mingw=true;;
OS400*) os400=true;;
Darwin*) darwin=true
if [ -z "$JAVA_VERSION" ] ; then
JAVA_VERSION="CurrentJDK"
else
echo "Using Java version: $JAVA_VERSION"
fi
if [ -z "$JAVA_HOME" ] ; then
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
fi
;;
esac
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
# Get standard environment variables
TEMPCURDIR=`dirname "$PRG"`
# Only set RUNTIME_HOME if not already set
[ -z "$RUNTIME_HOME" ] && RUNTIME_HOME=`cd "$TEMPCURDIR/.." ; pwd`
# Only set CARBON_HOME if not already set
[ -z "$CARBON_HOME" ] && CARBON_HOME=`cd "$TEMPCURDIR/../../../" ; pwd`
# Only set RUNTIME if not already set
[ -z "$RUNTIME" ] && RUNTIME=${RUNTIME_HOME##*/}
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CARBON_HOME" ] && CARBON_HOME=`cygpath --unix "$CARBON_HOME"`
[ -n "$RUNTIME_HOME" ] && RUNTIME_HOME=`cygpath --unix "$RUNTIME_HOME"`
fi
# For OS400
if $os400; then
# Set job priority to standard for interactive (interactive - 6) by using
# the interactive priority - 6, the helper threads that respond to requests
# will be running at the same priority as interactive jobs.
COMMAND='chgjob job('$JOBNAME') runpty(6)'
system $COMMAND
# Enable multi threading
QIBM_MULTI_THREADED=Y
export QIBM_MULTI_THREADED
fi
# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$CARBON_HOME" ] &&
CARBON_HOME="`(cd "$CARBON_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
# TODO classpath?
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD=java
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly."
echo " CARBON cannot execute $JAVACMD"
exit 1
fi
# if JAVA_HOME is not set we're not happy
if [ -z "$JAVA_HOME" ]; then
echo "You must set the JAVA_HOME variable before running CARBON."
exit 1
fi
if [ -e "$RUNTIME_HOME/runtime.pid" ]; then
PID=`cat "$RUNTIME_HOME"/runtime.pid`
fi
# ----- Process the input command ----------------------------------------------
args=""
for c in $*
do
if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug" ]; then
CMD="--debug"
continue
elif [ "$CMD" = "--debug" ]; then
if [ -z "$PORT" ]; then
PORT=$c
fi
elif [ "$c" = "--stop" ] || [ "$c" = "-stop" ] || [ "$c" = "stop" ]; then
CMD="stop"
elif [ "$c" = "--start" ] || [ "$c" = "-start" ] || [ "$c" = "start" ]; then
CMD="start"
elif [ "$c" = "--version" ] || [ "$c" = "-version" ] || [ "$c" = "version" ]; then
CMD="version"
elif [ "$c" = "--restart" ] || [ "$c" = "-restart" ] || [ "$c" = "restart" ]; then
CMD="restart"
elif [ "$c" = "--test" ] || [ "$c" = "-test" ] || [ "$c" = "test" ]; then
CMD="test"
else
args="$args $c"
fi
done
if [ "$CMD" = "--debug" ]; then
if [ "$PORT" = "" ]; then
echo " Please specify the debug port after the --debug option"
exit 1
fi
if [ -n "$JAVA_OPTS" ]; then
echo "Warning !!!. User specified JAVA_OPTS will be ignored, once you give the --debug option."
fi
CMD="RUN"
JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=$PORT"
echo "Please start the remote debugging client to continue..."
elif [ "$CMD" = "start" ]; then
if [ -e "$RUNTIME_HOME/runtime.pid" ]; then
if ps -p $PID > /dev/null ; then
echo "Process is already running"
exit 0
fi
fi
export CARBON_HOME=$CARBON_HOME
# using nohup bash to avoid erros in solaris OS.TODO
nohup bash $RUNTIME_HOME/bin/carbon.sh $args > /dev/null 2>&1 &
exit 0
elif [ "$CMD" = "stop" ]; then
export CARBON_HOME=$CARBON_HOME
kill -term `cat $RUNTIME_HOME/runtime.pid`
exit 0
elif [ "$CMD" = "restart" ]; then
export CARBON_HOME=$CARBON_HOME
kill -term `cat $RUNTIME_HOME/runtime.pid`
process_status=0
pid=`cat $RUNTIME_HOME/runtime.pid`
while [ "$process_status" -eq "0" ]
do
sleep 1;
ps -p$pid 2>&1 > /dev/null
process_status=$?
done
# using nohup bash to avoid erros in solaris OS.TODO
nohup bash $RUNTIME_HOME/bin/carbon.sh $args > /dev/null 2>&1 &
exit 0
elif [ "$CMD" = "test" ]; then
JAVACMD="exec "$JAVACMD""
elif [ "$CMD" = "version" ]; then
cat $CARBON_HOME/bin/kernel-version.txt
exit 0
fi
# ---------- Handle the SSL Issue with proper JDK version --------------------
java_version=$("$JAVACMD" -version 2>&1 | awk -F '"' '/version/ {print $2}')
java_version_formatted=$(echo "$java_version" | awk -F. '{printf("%02d%02d",$1,$2);}')
if [ $java_version_formatted -lt 0108 ] || [ $java_version_formatted -gt 1100 ]; then
echo " Starting WSO2 Carbon (in unsupported JDK)"
echo " [ERROR] CARBON is supported only on JDK 1.8 and 11"
fi
CARBON_XBOOTCLASSPATH=""
for f in "$CARBON_HOME"/bin/bootstrap/xboot/*.jar
do
if [ "$f" != "$CARBON_HOME/bin/bootstrap/xboot/*.jar" ];then
CARBON_XBOOTCLASSPATH="$CARBON_XBOOTCLASSPATH":$f
fi
done
JAVA_ENDORSED_DIRS="$CARBON_HOME/bin/bootstrap/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed"
CARBON_CLASSPATH=""
if [ -e "$JAVA_HOME/bin/bootstrap/tools.jar" ]; then
CARBON_CLASSPATH="$JAVA_HOME/lib/tools.jar"
fi
for f in "$CARBON_HOME"/bin/bootstrap/*.jar
do
if [ "$f" != "$CARBON_HOME/bin/bootstrap/*.jar" ];then
CARBON_CLASSPATH="$CARBON_CLASSPATH":$f
fi
done
for t in "$CARBON_HOME"/bin/bootstrap/commons-lang*.jar
do
CARBON_CLASSPATH="$CARBON_CLASSPATH":$t
done
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
CARBON_HOME=`cygpath --absolute --windows "$CARBON_HOME"`
RUNTIME_HOME=`cygpath --absolute --windows "$RUNTIME_HOME"`
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
if [ $java_version_formatted -le 0108 ]; then
JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
fi
CARBON_CLASSPATH=`cygpath --path --windows "$CARBON_CLASSPATH"`
CARBON_XBOOTCLASSPATH=`cygpath --path --windows "$CARBON_XBOOTCLASSPATH"`
fi
# ----- Execute The Requested Command -----------------------------------------
echo JAVA_HOME environment variable is set to $JAVA_HOME
echo CARBON_HOME environment variable is set to $CARBON_HOME
echo RUNTIME_HOME environment variable is set to $RUNTIME_HOME
cd "$RUNTIME_HOME"
START_EXIT_STATUS=121
status=$START_EXIT_STATUS
#To monitor a Carbon server in remote JMX mode on linux host machines, set the below system property.
# -Djava.rmi.server.hostname="your.IP.goes.here"
JAVA_VER_BASED_OPTS=""
if [ $java_version_formatted -le 0108 ]; then
JAVA_VER_BASED_OPTS="-Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS"
fi
if [ $java_version_formatted -ge 1100 ] ; then
JAVA_VER_BASED_OPTS="--add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED"
fi
while [ "$status" = "$START_EXIT_STATUS" ]
do
$JAVACMD \
-Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
-Xms{{ .Values.wso2.deployment.analytics.dashboard.resources.jvm.heap.memory.xms }} -Xmx{{ .Values.wso2.deployment.analytics.dashboard.resources.jvm.heap.memory.xmx }} \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath="$RUNTIME_HOME/logs/heap-dump.hprof" \
$JAVA_OPTS \
-classpath "$CARBON_CLASSPATH" \
$JAVA_VER_BASED_OPTS \
-Djava.io.tmpdir="$CARBON_HOME/tmp" \
-Dcarbon.registry.root=/ \
-Djava.command="$JAVACMD" \
-Dcarbon.home="$CARBON_HOME" \
-Dwso2.runtime.path="$RUNTIME_HOME" \
-Dwso2.runtime="$RUNTIME" \
-Djavax.xml.bind.JAXBContextFactory="com.sun.xml.bind.v2.ContextFactory" \
-Djava.util.logging.config.file="$RUNTIME_HOME/bin/bootstrap/logging.properties" \
-Djava.security.egd=file:/dev/./urandom \
-Dfile.encoding=UTF8 \
-Djavax.net.ssl.keyStore="$CARBON_HOME/resources/security/wso2carbon.jks" \
-Djavax.net.ssl.keyStorePassword="wso2carbon" \
-Djavax.net.ssl.trustStore="$CARBON_HOME/resources/security/client-truststore.jks" \
-Djavax.net.ssl.trustStorePassword="wso2carbon" \
-Dio.netty.tryReflectionSetAccessible=false \
org.wso2.carbon.launcher.Main $*
status=$?
done
---
apiVersion: v1
kind: ConfigMap
metadata:
name: wso2am-p1-analytics-dash-conf
namespace: wso2-system
data:
deployment.yaml: |
################################################################################
# Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the \"License\");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an \"AS IS\" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
# Carbon Configuration Parameters
wso2.carbon:
type: wso2-apim-analytics
# value to uniquely identify a server
id: wso2-am-analytics
# server name
name: WSO2 API Manager Analytics Server
# enable/disable hostname verifier
hostnameVerificationEnabled: false
# ports used by this server
ports:
# port offset
offset: 3
# Configuration used for the databridge communication
databridge.config:
# No of worker threads to consume events
# THIS IS A MANDATORY FIELD
workerThreads: 10
# Maximum amount of messages that can be queued internally in MB
# THIS IS A MANDATORY FIELD
maxEventBufferCapacity: 10000000
# Queue size; the maximum number of events that can be stored in the queue
# THIS IS A MANDATORY FIELD
eventBufferSize: 2000
# Keystore file path
# THIS IS A MANDATORY FIELD
keyStoreLocation : ${sys:carbon.home}/resources/security/wso2carbon.jks
# Keystore password
# THIS IS A MANDATORY FIELD
keyStorePassword : wso2carbon
# Session Timeout value in mins
# THIS IS A MANDATORY FIELD
clientTimeoutMin: 30
# Data receiver configurations
# THIS IS A MANDATORY FIELD
dataReceivers:
-
# Data receiver configuration
dataReceiver:
# Data receiver type
# THIS IS A MANDATORY FIELD
type: Thrift
# Data receiver properties
properties:
tcpPort: '7611'
sslPort: '7711'
-
# Data receiver configuration
dataReceiver:
# Data receiver type
# THIS IS A MANDATORY FIELD
type: Binary
# Data receiver properties
properties:
tcpPort: '9611'
sslPort: '9711'
tcpReceiverThreadPoolSize: '100'
sslReceiverThreadPoolSize: '100'
hostName: 0.0.0.0
# Configuration of the Data Agents - to publish events through databridge
data.agent.config:
# Data agent configurations
# THIS IS A MANDATORY FIELD
agents:
-
# Data agent configuration
agentConfiguration:
# Data agent name
# THIS IS A MANDATORY FIELD
name: Thrift
# Data endpoint class
# THIS IS A MANDATORY FIELD
dataEndpointClass: org.wso2.carbon.databridge.agent.endpoint.thrift.ThriftDataEndpoint
# Data publisher strategy
publishingStrategy: async
# Trust store path
trustStorePath: '${sys:carbon.home}/resources/security/client-truststore.jks'
# Trust store password
trustStorePassword: 'wso2carbon'
# Queue Size
queueSize: 32768
# Batch Size
batchSize: 200
# Core pool size
corePoolSize: 1
# Socket timeout in milliseconds
socketTimeoutMS: 30000
# Maximum pool size
maxPoolSize: 1
# Keep alive time in pool
keepAliveTimeInPool: 20
# Reconnection interval
reconnectionInterval: 30
# Max transport pool size
maxTransportPoolSize: 250
# Max idle connections
maxIdleConnections: 250
# Eviction time interval
evictionTimePeriod: 5500
# Min idle time in pool
minIdleTimeInPool: 5000
# Secure max transport pool size
secureMaxTransportPoolSize: 250
# Secure max idle connections
secureMaxIdleConnections: 250
# secure eviction time period
secureEvictionTimePeriod: 5500
# Secure min idle time in pool
secureMinIdleTimeInPool: 5000
# SSL enabled protocols
sslEnabledProtocols: TLSv1.1,TLSv1.2
# Ciphers
ciphers: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
-
# Data agent configuration
agentConfiguration:
# Data agent name
# THIS IS A MANDATORY FIELD
name: Binary
# Data endpoint class
# THIS IS A MANDATORY FIELD
dataEndpointClass: org.wso2.carbon.databridge.agent.endpoint.binary.BinaryDataEndpoint
# Data publisher strategy
publishingStrategy: async
# Trust store path
trustStorePath: '${sys:carbon.home}/resources/security/client-truststore.jks'
# Trust store password
trustStorePassword: 'wso2carbon'
# Queue Size
queueSize: 32768
# Batch Size
batchSize: 200
# Core pool size
corePoolSize: 1
# Socket timeout in milliseconds
socketTimeoutMS: 30000
# Maximum pool size
maxPoolSize: 1
# Keep alive time in pool
keepAliveTimeInPool: 20
# Reconnection interval
reconnectionInterval: 30
# Max transport pool size
maxTransportPoolSize: 250
# Max idle connections
maxIdleConnections: 250
# Eviction time interval
evictionTimePeriod: 5500
# Min idle time in pool
minIdleTimeInPool: 5000
# Secure max transport pool size
secureMaxTransportPoolSize: 250
# Secure max idle connections
secureMaxIdleConnections: 250
# secure eviction time period
secureEvictionTimePeriod: 5500
# Secure min idle time in pool
secureMinIdleTimeInPool: 5000
# SSL enabled protocols
sslEnabledProtocols: TLSv1.1,TLSv1.2
# Ciphers
ciphers: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
# Deployment configuration parameters
wso2.artifact.deployment:
# Scheduler update interval
updateInterval: 5
# HA Configuration
state.persistence:
enabled: false
intervalInMin: 1
revisionsToKeep: 2
persistenceStore: org.wso2.carbon.streaming.integrator.core.persistence.FileSystemPersistenceStore
config:
location: siddhi-app-persistence
# Secure Vault Configuration
wso2.securevault:
secretRepository:
type: org.wso2.carbon.secvault.repository.DefaultSecretRepository
parameters:
privateKeyAlias: wso2carbon
keystoreLocation: ${sys:carbon.home}/resources/security/securevault.jks
secretPropertiesFile: ${sys:carbon.home}/conf/${sys:wso2.runtime}/secrets.properties
masterKeyReader:
type: org.wso2.carbon.secvault.reader.DefaultMasterKeyReader
parameters:
masterKeyReaderFile: ${sys:carbon.home}/conf/${sys:wso2.runtime}/master-keys.yaml
# Data Sources Configuration
wso2.datasources:
dataSources:
# Dashboard data source
- name: WSO2_DASHBOARD_DB
description: The datasource used for dashboard feature
jndiConfig:
name: jdbc/DASHBOARD_DB
useJndiReference: true
definition:
type: RDBMS
configuration:
jdbcUrl: 'jdbc:mysql://mysql-svc:3306/DASHBOARD_DB?useSSL=false'
username: wso2carbon
password: wso2carbon
driverClassName: com.mysql.cj.jdbc.Driver
maxPoolSize: 20
idleTimeout: 60000
connectionTestQuery: SELECT 1
validationTimeout: 30000
isAutoCommit: false
- name: BUSINESS_RULES_DB
description: The datasource used for dashboard feature
jndiConfig:
name: jdbc/BUSINESS_RULES_DB
useJndiReference: true
definition:
type: RDBMS
configuration:
jdbcUrl: 'jdbc:mysql://mysql-svc:3306/BUSINESS_RULES_DB?useSSL=false'
username: wso2carbon
password: wso2carbon
driverClassName: com.mysql.cj.jdbc.Driver
maxPoolSize: 20
idleTimeout: 60000
connectionTestQuery: SELECT 1
validationTimeout: 30000
isAutoCommit: false
# carbon metrics data source
- name: WSO2_METRICS_DB
description: The datasource used for dashboard feature
jndiConfig:
name: jdbc/WSO2MetricsDB
definition:
type: RDBMS
configuration:
jdbcUrl: 'jdbc:h2:${sys:carbon.home}/wso2/dashboard/database/metrics;AUTO_SERVER=TRUE'
username: wso2carbon
password: wso2carbon
driverClassName: org.h2.Driver
maxPoolSize: 20
idleTimeout: 60000
connectionTestQuery: SELECT 1
validationTimeout: 30000
isAutoCommit: false
- name: WSO2_PERMISSIONS_DB
description: The datasource used for dashboard feature
jndiConfig:
name: jdbc/PERMISSION_DB
useJndiReference: true
definition:
type: RDBMS
configuration:
jdbcUrl: 'jdbc:mysql://mysql-svc:3306/PERMISSION_DB?useSSL=false'
username: wso2carbon
password: wso2carbon
driverClassName: com.mysql.cj.jdbc.Driver
maxPoolSize: 10
idleTimeout: 60000
connectionTestQuery: SELECT 1
validationTimeout: 30000
isAutoCommit: false
#Data source for APIM Analytics
- name: APIM_ANALYTICS_DB
description: Datasource used for APIM Analytics
jndiConfig:
name: jdbc/APIM_ANALYTICS_DB
definition:
type: RDBMS
configuration:
jdbcUrl: 'jdbc:mysql://mysql-svc:3306/APIM_ANALYTICS_DB?useSSL=false'
username: wso2carbon
password: wso2carbon
driverClassName: com.mysql.cj.jdbc.Driver
maxPoolSize: 50
idleTimeout: 60000
connectionTestQuery: SELECT 1
validationTimeout: 30000
isAutoCommit: false
#Main datasource used in API Manager
- name: AM_DB
description: Main datasource used by API Manager
jndiConfig:
name: jdbc/AM_DB
definition:
type: RDBMS
configuration:
jdbcUrl: "jdbc:mysql://mysql-svc:3306/WSO2AM_APIMGT_DB?useSSL=false"
username: wso2carbon
password: wso2carbon
driverClassName: com.mysql.cj.jdbc.Driver
maxPoolSize: 10
idleTimeout: 60000
connectionTestQuery: SELECT 1
validationTimeout: 30000
isAutoCommit: false
wso2.business.rules.manager:
datasource: BUSINESS_RULES_DB
# rule template wise configuration for deploying business rules
deployment_configs:
-
# <IP>:<HTTPS Port> of the Worker node
localhost:9444:
# UUIDs of rule templates that are needed to be deployed on the node
- stock-data-analysis
- stock-exchange-input
- stock-exchange-output
- identifying-continuous-production-decrease
- popular-tweets-analysis
- http-analytics-processing
- message-tracing-source-template
- message-tracing-app-template
# credentials for worker nodes
username: admin
password: admin
wso2.transport.http:
transportProperties:
- name: "server.bootstrap.socket.timeout"
value: 60
- name: "client.bootstrap.socket.timeout"
value: 60
- name: "latency.metrics.enabled"
value: true
listenerConfigurations:
- id: "default"
host: "0.0.0.0"
port: 9089
- id: "default-https"
host: "0.0.0.0"
port: 9640
scheme: https
keyStoreFile: "${carbon.home}/resources/security/wso2carbon.jks"
keyStorePassword: wso2carbon
certPass: wso2carbon
## Dashboard data provider authorization
data.provider.configs:
authorizingClass: org.wso2.analytics.apim.dashboards.core.data.provider.Authorizer
## Additional APIs that needs to be added to the server.
## Should be provided as a key value pairs { API context path: Microservice implementation class }
## The configured APIs will be available as https://{host}:{port}/analytics-dashboard/{API_context_path}
additional.apis:
/apis/analytics/v1.0/apim: org.wso2.analytics.apim.rest.api.proxy.ApimApi
/apis/v1.0/report: org.wso2.analytics.apim.rest.api.report.ReportApi
report:
implClass: org.wso2.analytics.apim.rest.api.report.reportgen.DefaultReportGeneratorImpl
## Authentication configuration
auth.configs:
type: apim
ssoEnabled: true
properties:
adminScope: apim_analytics:admin_carbon.super
allScopes: apim_analytics:admin openid apim:api_view apim:subscribe apim_analytics:monitoring_dashboard:own apim_analytics:monitoring_dashboard:edit apim_analytics:monitoring_dashboard:view apim_analytics:business_analytics:own apim_analytics:business_analytics:edit apim_analytics:business_analytics:view apim_analytics:api_analytics:own apim_analytics:api_analytics:edit apim_analytics:api_analytics:view apim_analytics:application_analytics:own apim_analytics:application_analytics:edit apim_analytics:application_analytics:view
adminUsername: admin
adminPassword: admin
kmDcrUrl: https://wso2-am-svc:9443/client-registration/v0.17/register
kmTokenUrlForRedirection: https://wso2apim:9443/oauth2
kmTokenUrl: https://wso2-am-svc:9443/oauth2
kmUsername: admin
kmPassword: admin
portalAppContext: analytics-dashboard
businessRulesAppContext : business-rules
cacheTimeout: 30
baseUrl: https://wso2apim-analytics:9643
grantType: authorization_code
publisherUrl: https://wso2-am-svc:9443
devPortalUrl: https://wso2-am-svc:9443
externalLogoutUrl: https://wso2apim:9443/oidc/logout
wso2.dashboard:
roles:
creators:
- apim_analytics:admin_carbon.super
themeConfigProviderClass: org.wso2.carbon.dashboards.core.DefaultDashboardThemeConfigProvider
## RDBMS Data Provider configuration
wso2.rdbms.data.provider:
timeTypes:
- DATE
- TIME
- DATETIME
- TIMESTAMP
- TIMESTAMP WITHOUT TIME ZONE
---
apiVersion: v1
kind: ConfigMap
metadata:
name: wso2am-p1-analytics-worker-conf
namespace: wso2-system
data:
deployment.yaml: |
################################################################################
# Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the \"License\");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an \"AS IS\" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
# Carbon Configuration Parameters
wso2.carbon:
type: wso2-apim-analytics
# value to uniquely identify a server
id: wso2-am-analytics
# server name
name: WSO2 API Manager Analytics Server
# ports used by this server
ports:
# port offset
offset: 1
wso2.transport.http:
transportProperties:
-
name: "server.bootstrap.socket.timeout"
value: 60
-
name: "client.bootstrap.socket.timeout"
value: 60
-
name: "latency.metrics.enabled"
value: true
listenerConfigurations:
-
id: "default"
host: "0.0.0.0"
port: 9090
-
id: "msf4j-https"
host: "0.0.0.0"
port: 9443
scheme: https
keyStoreFile: "${carbon.home}/resources/security/wso2carbon.jks"
keyStorePassword: wso2carbon
certPass: wso2carbon
senderConfigurations:
-
id: "http-sender"
siddhi.stores.query.api:
transportProperties:
-
name: "server.bootstrap.socket.timeout"
value: 60
-
name: "client.bootstrap.socket.timeout"
value: 60
-
name: "latency.metrics.enabled"
value: true
listenerConfigurations:
-
id: "default"
host: "0.0.0.0"
port: 7071
-
id: "msf4j-https"
host: "0.0.0.0"
port: 7444
scheme: https
keyStoreFile: "${carbon.home}/resources/security/wso2carbon.jks"
keyStorePassword: wso2carbon
certPass: wso2carbon
# Configuration used for the databridge communication
databridge.config:
# No of worker threads to consume events
# THIS IS A MANDATORY FIELD
workerThreads: 10
# Maximum amount of messages that can be queued internally in MB
# THIS IS A MANDATORY FIELD
maxEventBufferCapacity: 10000000
# Queue size; the maximum number of events that can be stored in the queue
# THIS IS A MANDATORY FIELD
eventBufferSize: 2000
# Keystore file path
# THIS IS A MANDATORY FIELD
keyStoreLocation : ${sys:carbon.home}/resources/security/wso2carbon.jks
# Keystore password
# THIS IS A MANDATORY FIELD
keyStorePassword : wso2carbon
# Session Timeout value in mins
# THIS IS A MANDATORY FIELD
clientTimeoutMin: 30
# Data receiver configurations
# THIS IS A MANDATORY FIELD
dataReceivers:
-
# Data receiver configuration
dataReceiver:
# Data receiver type
# THIS IS A MANDATORY FIELD
type: Thrift
# Data receiver properties
properties:
tcpPort: '7611'
sslPort: '7711'
-
# Data receiver configuration
dataReceiver:
# Data receiver type
# THIS IS A MANDATORY FIELD
type: Binary
# Data receiver properties
properties:
tcpPort: '9611'
sslPort: '9711'
tcpReceiverThreadPoolSize: '100'
sslReceiverThreadPoolSize: '100'
hostName: 0.0.0.0
# Configuration of the Data Agents - to publish events through databridge
data.agent.config:
# Data agent configurations
# THIS IS A MANDATORY FIELD
agents:
-
# Data agent configuration
agentConfiguration:
# Data agent name
# THIS IS A MANDATORY FIELD
name: Thrift
# Data endpoint class
# THIS IS A MANDATORY FIELD
dataEndpointClass: org.wso2.carbon.databridge.agent.endpoint.thrift.ThriftDataEndpoint
# Data publisher strategy
publishingStrategy: async
# Trust store path
trustStorePath: '${sys:carbon.home}/resources/security/client-truststore.jks'
# Trust store password
trustStorePassword: 'wso2carbon'
# Queue Size
queueSize: 32768
# Batch Size
batchSize: 200
# Core pool size
corePoolSize: 1
# Socket timeout in milliseconds
socketTimeoutMS: 30000
# Maximum pool size
maxPoolSize: 1
# Keep alive time in pool
keepAliveTimeInPool: 20
# Reconnection interval
reconnectionInterval: 30
# Max transport pool size
maxTransportPoolSize: 250
# Max idle connections
maxIdleConnections: 250
# Eviction time interval
evictionTimePeriod: 5500
# Min idle time in pool
minIdleTimeInPool: 5000
# Secure max transport pool size
secureMaxTransportPoolSize: 250
# Secure max idle connections
secureMaxIdleConnections: 250
# secure eviction time period
secureEvictionTimePeriod: 5500
# Secure min idle time in pool
secureMinIdleTimeInPool: 5000
# SSL enabled protocols
sslEnabledProtocols: TLSv1.1,TLSv1.2
# Ciphers
ciphers: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
-
# Data agent configuration
agentConfiguration:
# Data agent name
# THIS IS A MANDATORY FIELD
name: Binary
# Data endpoint class
# THIS IS A MANDATORY FIELD
dataEndpointClass: org.wso2.carbon.databridge.agent.endpoint.binary.BinaryDataEndpoint
# Data publisher strategy
publishingStrategy: async
# Trust store path
trustStorePath: '${sys:carbon.home}/resources/security/client-truststore.jks'
# Trust store password
trustStorePassword: 'wso2carbon'
# Queue Size
queueSize: 32768
# Batch Size
batchSize: 200
# Core pool size
corePoolSize: 1
# Socket timeout in milliseconds
socketTimeoutMS: 30000
# Maximum pool size
maxPoolSize: 1
# Keep alive time in pool
keepAliveTimeInPool: 20
# Reconnection interval
reconnectionInterval: 30
# Max transport pool size
maxTransportPoolSize: 250
# Max idle connections
maxIdleConnections: 250
# Eviction time interval
evictionTimePeriod: 5500
# Min idle time in pool
minIdleTimeInPool: 5000
# Secure max transport pool size
secureMaxTransportPoolSize: 250
# Secure max idle connections
secureMaxIdleConnections: 250
# secure eviction time period
secureEvictionTimePeriod: 5500
# Secure min idle time in pool
secureMinIdleTimeInPool: 5000
# SSL enabled protocols
sslEnabledProtocols: TLSv1.1,TLSv1.2
# Ciphers
ciphers: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
# This is the main configuration for metrics
wso2.metrics:
# Enable Metrics
enabled: false
reporting:
console:
- # The name for the Console Reporter
name: Console
# Enable Console Reporter
enabled: false
# Polling Period in seconds.
# This is the period for polling metrics from the metric registry and printing in the console
pollingPeriod: 5
wso2.metrics.jdbc:
# Data Source Configurations for JDBC Reporters
dataSource:
# Default Data Source Configuration
- &JDBC01
# JNDI name of the data source to be used by the JDBC Reporter.
# This data source should be defined in a *-datasources.xml file in conf/datasources directory.
dataSourceName: java:comp/env/jdbc/WSO2MetricsDB
# Schedule regular deletion of metrics data older than a set number of days.
# It is recommended that you enable this job to ensure your metrics tables do not get extremely large.
# Deleting data older than seven days should be sufficient.
scheduledCleanup:
# Enable scheduled cleanup to delete Metrics data in the database.
enabled: true
# The scheduled job will cleanup all data older than the specified days
daysToKeep: 3
# This is the period for each cleanup operation in seconds.
scheduledCleanupPeriod: 86400
# The JDBC Reporter is in the Metrics JDBC Core feature
reporting:
# The JDBC Reporter configurations will be ignored if the Metrics JDBC Core feature is not available in runtime
jdbc:
- # The name for the JDBC Reporter
name: JDBC
# Enable JDBC Reporter
enabled: true
# Source of Metrics, which will be used to identify each metric in database -->
# Commented to use the hostname by default
# source: Carbon
# Alias referring to the Data Source configuration
dataSource: *JDBC01
# Polling Period in seconds.
# This is the period for polling metrics from the metric registry and updating the database with the values
pollingPeriod: 60
# Deployment configuration parameters
wso2.artifact.deployment:
# Scheduler update interval
updateInterval: 5
# Periodic Persistence Configuration
state.persistence:
enabled: true
intervalInMin: 1
revisionsToKeep: 2
persistenceStore: org.wso2.carbon.streaming.integrator.core.persistence.DBPersistenceStore
config:
datasource: PERSISTENCE_DB # A datasource with this name should be defined in wso2.datasources namespace
table: PERSISTENCE_TABLE
# Secure Vault Configuration
wso2.securevault:
secretRepository:
type: org.wso2.carbon.secvault.repository.DefaultSecretRepository
parameters:
privateKeyAlias: wso2carbon
keystoreLocation: ${sys:carbon.home}/resources/security/securevault.jks
secretPropertiesFile: ${sys:carbon.home}/conf/${sys:wso2.runtime}/secrets.properties
masterKeyReader:
type: org.wso2.carbon.secvault.reader.DefaultMasterKeyReader
parameters:
masterKeyReaderFile: ${sys:carbon.home}/conf/${sys:wso2.runtime}/master-keys.yaml
# Datasource Configurations
wso2.datasources:
dataSources:
# carbon metrics data source
- name: WSO2_METRICS_DB
description: The datasource used for dashboard feature
jndiConfig:
name: jdbc/WSO2MetricsDB
definition:
type: RDBMS
configuration:
jdbcUrl: 'jdbc:h2:${sys:carbon.home}/wso2/dashboard/database/metrics;AUTO_SERVER=TRUE'
username: wso2carbon
password: wso2carbon
driverClassName: org.h2.Driver
maxPoolSize: 30
idleTimeout: 60000
connectionTestQuery: SELECT 1
validationTimeout: 30000
isAutoCommit: false
- name: WSO2_PERMISSIONS_DB
description: The datasource used for permission feature
jndiConfig:
name: jdbc/PERMISSION_DB
useJndiReference: true
definition:
type: RDBMS
configuration:
jdbcUrl: 'jdbc:mysql://mysql-svc:3306/PERMISSION_DB?useSSL=false'
username: wso2carbon
password: wso2carbon
driverClassName: com.mysql.cj.jdbc.Driver
maxPoolSize: 10
idleTimeout: 60000
connectionTestQuery: SELECT 1
validationTimeout: 30000
isAutoCommit: false
- name: GEO_LOCATION_DATA
description: "The data source used for geo location database"
jndiConfig:
name: jdbc/GEO_LOCATION_DATA
definition:
type: RDBMS
configuration:
jdbcUrl: 'jdbc:h2:${sys:carbon.home}/wso2/worker/database/GEO_LOCATION_DATA;AUTO_SERVER=TRUE'
username: wso2carbon
password: wso2carbon
driverClassName: org.h2.Driver
maxPoolSize: 50
idleTimeout: 60000
validationTimeout: 30000
isAutoCommit: false
- name: APIM_ANALYTICS_DB
description: "The datasource used for APIM statistics aggregated data."
jndiConfig:
name: jdbc/APIM_ANALYTICS_DB
definition:
type: RDBMS
configuration:
jdbcUrl: 'jdbc:mysql://mysql-svc:3306/APIM_ANALYTICS_DB?useSSL=false'
username: wso2carbon
password: wso2carbon
driverClassName: com.mysql.cj.jdbc.Driver
maxPoolSize: 50
idleTimeout: 60000
connectionTestQuery: SELECT 1
validationTimeout: 30000
isAutoCommit: false
-
name: WSO2_CLUSTER_DB
description: "The datasource used by cluster coordinators in HA deployment"
jndiConfig:
name: jdbc/WSO2_CLUSTER_DB
definition:
type: RDBMS
configuration:
connectionTestQuery: "SELECT 1"
driverClassName: com.mysql.cj.jdbc.Driver
idleTimeout: 60000
isAutoCommit: false
jdbcUrl: "jdbc:mysql://mysql-svc:3306/WSO2_CLUSTER_DB?useSSL=false"
maxPoolSize: 50
password: wso2carbon
username: wso2carbon
validationTimeout: 30000
-
name: PERSISTENCE_DB
description: "Datasource used for persistence"
jndiConfig:
name: jdbc/PERSISTENCE_DB
definition:
type: RDBMS
configuration:
connectionTestQuery: "SELECT 1"
driverClassName: com.mysql.cj.jdbc.Driver
idleTimeout: 60000
isAutoCommit: false
jdbcUrl: "jdbc:mysql://mysql-svc:3306/PERSISTENCE_DB?useSSL=false"
maxPoolSize: 50
password: wso2carbon
username: wso2carbon
validationTimeout: 30000
siddhi:
# properties:
# partitionById: true
# shardId: 1
refs:
- ref:
name: 'grpcSource'
type: 'grpc'
properties:
receiver.url : grpc://localhost:9806/org.wso2.analytics.mgw.grpc.service.AnalyticsSendService/sendAnalytics
extensions:
-
extension:
name: 'findCountryFromIP'
namespace: 'geo'
properties:
geoLocationResolverClass: org.wso2.extension.siddhi.execution.geo.internal.impl.DefaultDBBasedGeoLocationResolver
isCacheEnabled: true
cacheSize: 10000
isPersistInDatabase: true
datasource: GEO_LOCATION_DATA
-
extension:
name: 'findCityFromIP'
namespace: 'geo'
properties:
geoLocationResolverClass: org.wso2.extension.siddhi.execution.geo.internal.impl.DefaultDBBasedGeoLocationResolver
isCacheEnabled: true
cacheSize: 10000
isPersistInDatabase: true
datasource: GEO_LOCATION_DATA
#Enabling GRPC Service with an Extension
-
extension:
name: 'grpc'
namespace: 'source'
properties:
keyStoreFile : ${sys:carbon.home}/resources/security/wso2carbon.jks
keyStorePassword : wso2carbon
keyStoreAlgorithm : SunX509
trustStoreFile : ${sys:carbon.home}/resources/security/client-truststore.jks
trustStorePassword : wso2carbon
trustStoreAlgorithm : SunX509
-
extension:
name: 'getUserAgentProperty'
namespace: 'env'
properties:
regexFilePath : ${sys:carbon.home}/conf/worker/regexes.yaml
# Cluster Configuration
cluster.config:
enabled: true
groupId: sp
coordinationStrategyClass: org.wso2.carbon.cluster.coordinator.rdbms.RDBMSCoordinationStrategy
strategyConfig:
datasource: WSO2_CLUSTER_DB
heartbeatInterval: 5000
heartbeatMaxRetry: 5
eventPollingInterval: 5000
# Authentication configuration
auth.configs:
type: 'local' # Type of the IdP client used
userManager:
adminRole: admin # Admin role which is granted all permissions
userStore: # User store
users:
-
user:
username: admin
password: YWRtaW4=
roles: 1
roles:
-
role:
id: 1
displayName: admin
deployment.config:
type: ha
passiveNodeDetailsWaitTimeOutMillis: 300000
passiveNodeDetailsRetrySleepTimeMillis: 500
eventByteBufferQueueCapacity: 20000
byteBufferExtractorThreadPoolSize: 5
eventSyncServer:
host: 0.0.0.0
port: 9893
advertisedHost: wso2-am-analytics-worker-svc
advertisedPort: 9893
bossThreads: 10
workerThreads: 10
eventSyncClientPool:
maxActive: 10
maxTotal: 10
maxIdle: 10
maxWait: 60000
minEvictableIdleTimeMillis: 120000
# Configuration to enable apim alerts
#analytics.solutions:
# APIM-alerts.enabled: true
# Sample of deployment.config for Two node HA
# deployment.config:
# type: ha
# eventSyncServer:
# host: localhost
# port: 9893
# advertisedHost: localhost
# advertisedPort: 9893
# bossThreads: 10
# workerThreads: 10
# eventSyncClientPool:
# maxActive: 10
# maxTotal: 10
# maxIdle: 10
# maxWait: 60000
# minEvictableIdleTimeMillis: 120000
# Sample of deployment.config for Distributed deployment
#deployment.config:
# type: distributed
# httpsInterface:
# host: 192.168.1.3
# port: 9443
# username: admin
# password: admin
# leaderRetryInterval: 10000
# resourceManagers:
# - host: 192.168.1.1
# port: 9543
# username: admin
# password: admin
# - host: 192.168.1.2
# port: 9543
# username: admin
# password: admin
---
apiVersion: v1
kind: ConfigMap
metadata:
name: wso2am-p1-apim-1-conf
namespace: wso2-system
data:
deployment.toml: |-
[server]
hostname = "wso2apim"
node_ip = "$env{NODE_IP}"
#offset=0
mode = "single" #single or ha
base_path = "${carbon.protocol}://${carbon.host}:${carbon.management.port}"
#discard_empty_caches = false
server_role = "default"
[super_admin]
username = "admin"
password = "admin"
create_admin_account = true
[user_store]
type = "database_unique_id"
[database.apim_db]
type = "mysql"
url = "jdbc:mysql://mysql-svc:3306/WSO2AM_APIMGT_DB?useSSL=false"
username = "wso2carbon"
password = "wso2carbon"
driver = "com.mysql.cj.jdbc.Driver"
[database.shared_db]
type = "mysql"
url = "jdbc:mysql://mysql-svc:3306/WSO2AM_SHARED_DB?autoReconnect=true&amp;useSSL=false"
username = "wso2carbon"
password = "wso2carbon"
driver = "com.mysql.cj.jdbc.Driver"
[keystore.tls]
file_name = "wso2carbon.jks"
type = "JKS"
password = "wso2carbon"
alias = "wso2carbon"
key_password = "wso2carbon"
#[keystore.primary]
#file_name = "wso2carbon.jks"
#type = "JKS"
#password = "wso2carbon"
#alias = "wso2carbon"
#key_password = "wso2carbon"
#[keystore.internal]
#file_name = "wso2carbon.jks"
#type = "JKS"
#password = "wso2carbon"
#alias = "wso2carbon"
#key_password = "wso2carbon"
[[apim.gateway.environment]]
name = "Production and Sandbox"
type = "hybrid"
display_in_api_console = true
description = "This is a hybrid gateway that handles both production and sandbox token traffic."
show_as_token_endpoint_url = true
service_url = "https://localhost:${mgt.transport.https.port}/services/"
username= "${admin.username}"
password= "${admin.password}"
ws_endpoint = "ws://wso2apim:9099"
wss_endpoint = "wss://wso2apim:8099"
http_endpoint = "http://wso2apim:8280"
https_endpoint = "https://wso2apim:8243"
#[apim.cache.gateway_token]
#enable = true
#expiry_time = "900s"
#[apim.cache.resource]
#enable = true
#expiry_time = "900s"
#[apim.cache.km_token]
#enable = false
#expiry_time = "15m"
#[apim.cache.recent_apis]
#enable = false
#[apim.cache.scopes]
#enable = true
#[apim.cache.publisher_roles]
#enable = true
#[apim.cache.jwt_claim]
#enable = true
#expiry_time = "15m"
#[apim.cache.tags]
#expiry_time = "2m"
[apim.analytics]
enable = true
store_api_url = "https://wso2-am-analytics-worker-svc:7444"
username = "$ref{super_admin.username}"
password = "$ref{super_admin.password}"
event_publisher_type = "default"
event_publisher_impl = "org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher"
publish_response_size = true
[[apim.analytics.url_group]]
analytics_url =["tcp://wso2-am-analytics-worker-svc:7612"]
analytics_auth_url =["ssl://wso2-am-analytics-worker-svc:7712"]
#type = "loadbalance"
#[[apim.analytics.url_group]]
#analytics_url =["tcp://analytics1:7612","tcp://analytics2:7612"]
#analytics_auth_url =["ssl://analytics1:7712","ssl://analytics2:7712"]
#type = "failover"
#[apim.key_manager]
#service_url = "https://localhost:${mgt.transport.https.port}/services/"
#username = "$ref{super_admin.username}"
#password = "$ref{super_admin.password}"
#pool.init_idle_capacity = 50
#pool.max_idle = 100
#key_validation_handler_type = "default"
#key_validation_handler_type = "custom"
#key_validation_handler_impl = "org.wso2.carbon.apimgt.keymgt.handlers.DefaultKeyValidationHandler"
#[apim.idp]
#server_url = "https://localhost:${mgt.transport.https.port}"
#authorize_endpoint = "https://localhost:${mgt.transport.https.port}/oauth2/authorize"
#oidc_logout_endpoint = "https://localhost:${mgt.transport.https.port}/oidc/logout"
#oidc_check_session_endpoint = "https://localhost:${mgt.transport.https.port}/oidc/checksession"
#[apim.jwt]
#enable = true
#encoding = "base64" # base64,base64url
#generator_impl = "org.wso2.carbon.apimgt.keymgt.token.JWTGenerator"
#claim_dialect = "http://wso2.org/claims"
#convert_dialect = false
#header = "X-JWT-Assertion"
#signing_algorithm = "SHA256withRSA"
#enable_user_claims = true
#claims_extractor_impl = "org.wso2.carbon.apimgt.impl.token.ExtendedDefaultClaimsRetriever"
#[apim.oauth_config]
#enable_outbound_auth_header = false
#auth_header = "Authorization"
#revoke_endpoint = "https://localhost:${https.nio.port}/revoke"
#enable_token_encryption = false
#enable_token_hashing = false
[apim.devportal]
url = "https://wso2apim:9443/devportal"
#enable_application_sharing = false
#if application_sharing_type, application_sharing_impl both defined priority goes to application_sharing_impl
#application_sharing_type = "default" #changed type, saml, default #todo: check the new config for rest api
#application_sharing_impl = "org.wso2.carbon.apimgt.impl.SAMLGroupIDExtractorImpl"
#display_multiple_versions = false
#display_deprecated_apis = false
#enable_comments = true
#enable_ratings = true
#enable_forum = true
#enable_anonymous_mode=true
[apim.cors]
allow_origins = "*"
allow_methods = ["GET","PUT","POST","DELETE","PATCH","OPTIONS"]
allow_headers = ["authorization","Access-Control-Allow-Origin","Content-Type","SOAPAction","apikey", "testKey"]
allow_credentials = false
#[apim.throttling]
#enable_data_publishing = true
#enable_policy_deploy = true
#enable_blacklist_condition = true
#enable_persistence = true
#throttle_decision_endpoints = ["tcp://localhost:5672","tcp://localhost:5672"]
#[apim.throttling.blacklist_condition]
#start_delay = "5m"
#period = "1h"
#[apim.throttling.jms]
#start_delay = "5m"
#[apim.throttling.event_sync]
#hostName = "0.0.0.0"
#port = 11224
#[apim.throttling.event_management]
#hostName = "0.0.0.0"
#port = 10005
[[apim.throttling.url_group]]
traffic_manager_urls = ["tcp://localhost:9611"]
traffic_manager_auth_urls = ["ssl://localhost:9711"]
type = "loadbalance"
[[apim.throttling.url_group]]
traffic_manager_urls = ["tcp://wso2-am-2-svc:9611"]
traffic_manager_auth_urls = ["ssl://wso2-am-2-svc:9711"]
type = "loadbalance"
#[apim.workflow]
#enable = false
#service_url = "https://localhost:9445/bpmn"
#username = "$ref{super_admin.username}"
#password = "$ref{super_admin.password}"
#callback_endpoint = "https://localhost:${mgt.transport.https.port}/api/am/admin/v0.17/workflows/update-workflow-status"
#token_endpoint = "https://localhost:${https.nio.port}/token"
#client_registration_endpoint = "https://localhost:${mgt.transport.https.port}/client-registration/v0.17/register"
#client_registration_username = "$ref{super_admin.username}"
#client_registration_password = "$ref{super_admin.password}"
#data bridge config
#[transport.receiver]
#type = "binary"
#worker_threads = 10
#session_timeout = "30m"
#keystore.file_name = "$ref{keystore.tls.file_name}"
#keystore.password = "$ref{keystore.tls.password}"
#tcp_port = 9611
#ssl_port = 9711
#ssl_receiver_thread_pool_size = 100
#tcp_receiver_thread_pool_size = 100
#ssl_enabled_protocols = ["TLSv1","TLSv1.1","TLSv1.2"]
#ciphers = ["SSL_RSA_WITH_RC4_128_MD5","SSL_RSA_WITH_RC4_128_SHA"]
#[apim.notification]
#from_address = "APIM.com"
#username = "APIM"
#password = "APIM+123"
#hostname = "localhost"
#port = 3025
#enable_start_tls = false
#enable_authentication = true
#[apim.token.revocation]
#notifier_impl = "org.wso2.carbon.apimgt.keymgt.events.TokenRevocationNotifierImpl"
#enable_realtime_notifier = true
#realtime_notifier.ttl = 5000
#enable_persistent_notifier = true
#persistent_notifier.hostname = "https://localhost:2379/v2/keys/jti/"
#persistent_notifier.ttl = 5000
#persistent_notifier.username = "root"
#persistent_notifier.password = "root"
[[event_handler]]
name="userPostSelfRegistration"
subscriptions=["POST_ADD_USER"]
[service_provider]
sp_name_regex = "^[\\sa-zA-Z0-9._-]*$"
[database.local]
url = "jdbc:h2:./repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE"
[[event_listener]]
id = "token_revocation"
type = "org.wso2.carbon.identity.core.handler.AbstractIdentityHandler"
name = "org.wso2.is.notification.ApimOauthEventInterceptor"
order = 1
[event_listener.properties]
notification_endpoint = "https://localhost:${mgt.transport.https.port}/internal/data/v1/notify"
username = "${admin.username}"
password = "${admin.password}"
'header.X-WSO2-KEY-MANAGER' = "default"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: wso2am-p1-apim-2-conf
namespace: wso2-system
data:
deployment.toml: |-
[server]
hostname = "wso2apim"
node_ip = "$env{NODE_IP}"
#offset=0
mode = "single" #single or ha
base_path = "${carbon.protocol}://${carbon.host}:${carbon.management.port}"
#discard_empty_caches = false
server_role = "default"
[super_admin]
username = "admin"
password = "admin"
create_admin_account = true
[user_store]
type = "database_unique_id"
[database.apim_db]
type = "mysql"
url = "jdbc:mysql://mysql-svc:3306/WSO2AM_APIMGT_DB?useSSL=false"
username = "wso2carbon"
password = "wso2carbon"
driver = "com.mysql.cj.jdbc.Driver"
[database.shared_db]
type = "mysql"
url = "jdbc:mysql://mysql-svc:3306/WSO2AM_SHARED_DB?autoReconnect=true&amp;useSSL=false"
username = "wso2carbon"
password = "wso2carbon"
driver = "com.mysql.cj.jdbc.Driver"
[keystore.tls]
file_name = "wso2carbon.jks"
type = "JKS"
password = "wso2carbon"
alias = "wso2carbon"
key_password = "wso2carbon"
#[keystore.primary]
#file_name = "wso2carbon.jks"
#type = "JKS"
#password = "wso2carbon"
#alias = "wso2carbon"
#key_password = "wso2carbon"
#[keystore.internal]
#file_name = "wso2carbon.jks"
#type = "JKS"
#password = "wso2carbon"
#alias = "wso2carbon"
#key_password = "wso2carbon"
[[apim.gateway.environment]]
name = "Production and Sandbox"
type = "hybrid"
display_in_api_console = true
description = "This is a hybrid gateway that handles both production and sandbox token traffic."
show_as_token_endpoint_url = true
service_url = "https://localhost:${mgt.transport.https.port}/services/"
username= "${admin.username}"
password= "${admin.password}"
ws_endpoint = "ws://wso2apim:9099"
wss_endpoint = "wss://wso2apim:8099"
http_endpoint = "http://wso2apim:8280"
https_endpoint = "https://wso2apim:8243"
#[apim.cache.gateway_token]
#enable = true
#expiry_time = "900s"
#[apim.cache.resource]
#enable = true
#expiry_time = "900s"
#[apim.cache.km_token]
#enable = false
#expiry_time = "15m"
#[apim.cache.recent_apis]
#enable = false
#[apim.cache.scopes]
#enable = true
#[apim.cache.publisher_roles]
#enable = true
#[apim.cache.jwt_claim]
#enable = true
#expiry_time = "15m"
#[apim.cache.tags]
#expiry_time = "2m"
[apim.analytics]
enable = true
store_api_url = "https://wso2-am-analytics-worker-svc:7444"
username = "$ref{super_admin.username}"
password = "$ref{super_admin.password}"
event_publisher_type = "default"
event_publisher_impl = "org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher"
publish_response_size = true
[[apim.analytics.url_group]]
analytics_url =["tcp://wso2-am-analytics-worker-svc:7612"]
analytics_auth_url =["ssl://wso2-am-analytics-worker-svc:7712"]
#type = "loadbalance"
#[[apim.analytics.url_group]]
#analytics_url =["tcp://analytics1:7612","tcp://analytics2:7612"]
#analytics_auth_url =["ssl://analytics1:7712","ssl://analytics2:7712"]
#type = "failover"
#[apim.key_manager]
#service_url = "https://localhost:${mgt.transport.https.port}/services/"
#username = "$ref{super_admin.username}"
#password = "$ref{super_admin.password}"
#pool.init_idle_capacity = 50
#pool.max_idle = 100
#key_validation_handler_type = "default"
#key_validation_handler_type = "custom"
#key_validation_handler_impl = "org.wso2.carbon.apimgt.keymgt.handlers.DefaultKeyValidationHandler"
#[apim.idp]
#server_url = "https://localhost:${mgt.transport.https.port}"
#authorize_endpoint = "https://localhost:${mgt.transport.https.port}/oauth2/authorize"
#oidc_logout_endpoint = "https://localhost:${mgt.transport.https.port}/oidc/logout"
#oidc_check_session_endpoint = "https://localhost:${mgt.transport.https.port}/oidc/checksession"
#[apim.jwt]
#enable = true
#encoding = "base64" # base64,base64url
#generator_impl = "org.wso2.carbon.apimgt.keymgt.token.JWTGenerator"
#claim_dialect = "http://wso2.org/claims"
#convert_dialect = false
#header = "X-JWT-Assertion"
#signing_algorithm = "SHA256withRSA"
#enable_user_claims = true
#claims_extractor_impl = "org.wso2.carbon.apimgt.impl.token.ExtendedDefaultClaimsRetriever"
#[apim.oauth_config]
#enable_outbound_auth_header = false
#auth_header = "Authorization"
#revoke_endpoint = "https://localhost:${https.nio.port}/revoke"
#enable_token_encryption = false
#enable_token_hashing = false
[apim.devportal]
url = "https://wso2apim:9443/devportal"
#enable_application_sharing = false
#if application_sharing_type, application_sharing_impl both defined priority goes to application_sharing_impl
#application_sharing_type = "default" #changed type, saml, default #todo: check the new config for rest api
#application_sharing_impl = "org.wso2.carbon.apimgt.impl.SAMLGroupIDExtractorImpl"
#display_multiple_versions = false
#display_deprecated_apis = false
#enable_comments = true
#enable_ratings = true
#enable_forum = true
#enable_anonymous_mode=true
[apim.cors]
allow_origins = "*"
allow_methods = ["GET","PUT","POST","DELETE","PATCH","OPTIONS"]
allow_headers = ["authorization","Access-Control-Allow-Origin","Content-Type","SOAPAction","apikey", "testKey"]
allow_credentials = false
#[apim.throttling]
#enable_data_publishing = true
#enable_policy_deploy = true
#enable_blacklist_condition = true
#enable_persistence = true
#throttle_decision_endpoints = ["tcp://localhost:5672","tcp://localhost:5672"]
#[apim.throttling.blacklist_condition]
#start_delay = "5m"
#period = "1h"
#[apim.throttling.jms]
#start_delay = "5m"
#[apim.throttling.event_sync]
#hostName = "0.0.0.0"
#port = 11224
#[apim.throttling.event_management]
#hostName = "0.0.0.0"
#port = 10005
[[apim.throttling.url_group]]
traffic_manager_urls = ["tcp://localhost:9611"]
traffic_manager_auth_urls = ["ssl://localhost:9711"]
type = "loadbalance"
[[apim.throttling.url_group]]
traffic_manager_urls = ["tcp://wso2-am-1-svc:9611"]
traffic_manager_auth_urls = ["ssl://wso2-am-1-svc:9711"]
type = "loadbalance"
#[apim.workflow]
#enable = false
#service_url = "https://localhost:9445/bpmn"
#username = "$ref{super_admin.username}"
#password = "$ref{super_admin.password}"
#callback_endpoint = "https://localhost:${mgt.transport.https.port}/api/am/admin/v0.17/workflows/update-workflow-status"
#token_endpoint = "https://localhost:${https.nio.port}/token"
#client_registration_endpoint = "https://localhost:${mgt.transport.https.port}/client-registration/v0.17/register"
#client_registration_username = "$ref{super_admin.username}"
#client_registration_password = "$ref{super_admin.password}"
#data bridge config
#[transport.receiver]
#type = "binary"
#worker_threads = 10
#session_timeout = "30m"
#keystore.file_name = "$ref{keystore.tls.file_name}"
#keystore.password = "$ref{keystore.tls.password}"
#tcp_port = 9611
#ssl_port = 9711
#ssl_receiver_thread_pool_size = 100
#tcp_receiver_thread_pool_size = 100
#ssl_enabled_protocols = ["TLSv1","TLSv1.1","TLSv1.2"]
#ciphers = ["SSL_RSA_WITH_RC4_128_MD5","SSL_RSA_WITH_RC4_128_SHA"]
#[apim.notification]
#from_address = "APIM.com"
#username = "APIM"
#password = "APIM+123"
#hostname = "localhost"
#port = 3025
#enable_start_tls = false
#enable_authentication = true
#[apim.token.revocation]
#notifier_impl = "org.wso2.carbon.apimgt.keymgt.events.TokenRevocationNotifierImpl"
#enable_realtime_notifier = true
#realtime_notifier.ttl = 5000
#enable_persistent_notifier = true
#persistent_notifier.hostname = "https://localhost:2379/v2/keys/jti/"
#persistent_notifier.ttl = 5000
#persistent_notifier.username = "root"
#persistent_notifier.password = "root"
[[event_handler]]
name="userPostSelfRegistration"
subscriptions=["POST_ADD_USER"]
[service_provider]
sp_name_regex = "^[\\sa-zA-Z0-9._-]*$"
[database.local]
url = "jdbc:h2:./repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE"
[[event_listener]]
id = "token_revocation"
type = "org.wso2.carbon.identity.core.handler.AbstractIdentityHandler"
name = "org.wso2.is.notification.ApimOauthEventInterceptor"
order = 1
[event_listener.properties]
notification_endpoint = "https://localhost:${mgt.transport.https.port}/internal/data/v1/notify"
username = "${admin.username}"
password = "${admin.password}"
'header.X-WSO2-KEY-MANAGER' = "default"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: wso2am-p1-mysql-dbscripts
namespace: wso2-system
data:
init.sql: |
DROP DATABASE IF EXISTS DASHBOARD_DB;
DROP DATABASE IF EXISTS APIM_ANALYTICS_DB;
DROP DATABASE IF EXISTS PERMISSION_DB;
DROP DATABASE IF EXISTS GEO_LOCATION_DATA;
DROP DATABASE IF EXISTS BUSINESS_RULES_DB;
DROP DATABASE IF EXISTS WSO2AM_SHARED_DB;
DROP DATABASE IF EXISTS WSO2AM_APIMGT_DB;
DROP DATABASE IF EXISTS WSO2_CLUSTER_DB;
DROP DATABASE IF EXISTS PERSISTENCE_DB;
CREATE DATABASE DASHBOARD_DB;
CREATE DATABASE APIM_ANALYTICS_DB;
CREATE DATABASE PERMISSION_DB;
CREATE DATABASE GEO_LOCATION_DATA;
CREATE DATABASE BUSINESS_RULES_DB;
CREATE DATABASE WSO2AM_SHARED_DB;
CREATE DATABASE WSO2AM_APIMGT_DB;
CREATE DATABASE WSO2_CLUSTER_DB;
CREATE DATABASE PERSISTENCE_DB;
CREATE USER IF NOT EXISTS 'wso2carbon'@'%' IDENTIFIED BY 'wso2carbon';
GRANT ALL ON DASHBOARD_DB.* TO 'wso2carbon'@'%' IDENTIFIED BY 'wso2carbon';
GRANT ALL ON WSO2AM_APIMGT_DB.* TO 'wso2carbon'@'%' IDENTIFIED BY 'wso2carbon';
GRANT ALL ON APIM_ANALYTICS_DB.* TO 'wso2carbon'@'%' IDENTIFIED BY 'wso2carbon';
GRANT ALL ON PERMISSION_DB.* TO 'wso2carbon'@'%' IDENTIFIED BY 'wso2carbon';
GRANT ALL ON GEO_LOCATION_DATA.* TO 'wso2carbon'@'%' IDENTIFIED BY 'wso2carbon';
GRANT ALL ON BUSINESS_RULES_DB.* TO 'wso2carbon'@'%' IDENTIFIED BY 'wso2carbon';
GRANT ALL ON WSO2AM_SHARED_DB.* TO 'wso2carbon'@'%' IDENTIFIED BY 'wso2carbon';
GRANT ALL ON WSO2_CLUSTER_DB.* TO 'wso2carbon'@'%' IDENTIFIED BY 'wso2carbon';
GRANT ALL ON PERSISTENCE_DB.* TO 'wso2carbon'@'%' IDENTIFIED BY 'wso2carbon';
-- APIM Analytics --
USE APIM_ANALYTICS_DB;
CREATE TABLE IF NOT EXISTS AM_USAGE_UPLOADED_FILES (
FILE_NAME varchar(255) NOT NULL,
FILE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FILE_PROCESSED tinyint(1) DEFAULT 0,
FILE_CONTENT MEDIUMBLOB DEFAULT NULL,
PRIMARY KEY (FILE_NAME, FILE_TIMESTAMP)
);
-- APIM Shared DB --
USE WSO2AM_SHARED_DB;
CREATE TABLE IF NOT EXISTS REG_CLUSTER_LOCK (
REG_LOCK_NAME VARCHAR (20),
REG_LOCK_STATUS VARCHAR (20),
REG_LOCKED_TIME TIMESTAMP,
REG_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (REG_LOCK_NAME)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS REG_LOG (
REG_LOG_ID INTEGER AUTO_INCREMENT,
REG_PATH VARCHAR (750),
REG_USER_ID VARCHAR (31) NOT NULL,
REG_LOGGED_TIME TIMESTAMP NOT NULL,
REG_ACTION INTEGER NOT NULL,
REG_ACTION_DATA VARCHAR (500),
REG_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (REG_LOG_ID, REG_TENANT_ID)
)ENGINE INNODB;
CREATE INDEX REG_LOG_IND_BY_REGLOG USING HASH ON REG_LOG(REG_LOGGED_TIME, REG_TENANT_ID);
-- The REG_PATH_VALUE should be less than 767 bytes, and hence was fixed at 750.
-- See CARBON-5917.
CREATE TABLE IF NOT EXISTS REG_PATH(
REG_PATH_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_PATH_VALUE VARCHAR(750) NOT NULL,
REG_PATH_PARENT_ID INTEGER,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_PATH PRIMARY KEY(REG_PATH_ID, REG_TENANT_ID),
CONSTRAINT UNIQUE_REG_PATH_TENANT_ID UNIQUE (REG_PATH_VALUE,REG_TENANT_ID)
)ENGINE INNODB;
CREATE INDEX REG_PATH_IND_BY_PATH_PARENT_ID USING HASH ON REG_PATH(REG_PATH_PARENT_ID, REG_TENANT_ID);
CREATE TABLE IF NOT EXISTS REG_CONTENT (
REG_CONTENT_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_CONTENT_DATA LONGBLOB,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_CONTENT PRIMARY KEY(REG_CONTENT_ID, REG_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS REG_CONTENT_HISTORY (
REG_CONTENT_ID INTEGER NOT NULL,
REG_CONTENT_DATA LONGBLOB,
REG_DELETED SMALLINT,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_CONTENT_HISTORY PRIMARY KEY(REG_CONTENT_ID, REG_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS REG_RESOURCE (
REG_PATH_ID INTEGER NOT NULL,
REG_NAME VARCHAR(256),
REG_VERSION INTEGER NOT NULL AUTO_INCREMENT,
REG_MEDIA_TYPE VARCHAR(500),
REG_CREATOR VARCHAR(31) NOT NULL,
REG_CREATED_TIME TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
REG_LAST_UPDATOR VARCHAR(31),
REG_LAST_UPDATED_TIME TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
REG_DESCRIPTION VARCHAR(1000),
REG_CONTENT_ID INTEGER,
REG_TENANT_ID INTEGER DEFAULT 0,
REG_UUID VARCHAR(100) NOT NULL,
CONSTRAINT PK_REG_RESOURCE PRIMARY KEY(REG_VERSION, REG_TENANT_ID)
)ENGINE INNODB;
ALTER TABLE REG_RESOURCE ADD CONSTRAINT REG_RESOURCE_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
ALTER TABLE REG_RESOURCE ADD CONSTRAINT REG_RESOURCE_FK_BY_CONTENT_ID FOREIGN KEY (REG_CONTENT_ID, REG_TENANT_ID) REFERENCES REG_CONTENT (REG_CONTENT_ID, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_IND_BY_NAME USING HASH ON REG_RESOURCE(REG_NAME, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_IND_BY_PATH_ID_NAME USING HASH ON REG_RESOURCE(REG_PATH_ID, REG_NAME, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_IND_BY_UUID USING HASH ON REG_RESOURCE(REG_UUID);
CREATE INDEX REG_RESOURCE_IND_BY_TENAN USING HASH ON REG_RESOURCE(REG_TENANT_ID, REG_UUID);
CREATE INDEX REG_RESOURCE_IND_BY_TYPE USING HASH ON REG_RESOURCE(REG_TENANT_ID, REG_MEDIA_TYPE);
CREATE TABLE IF NOT EXISTS REG_RESOURCE_HISTORY (
REG_PATH_ID INTEGER NOT NULL,
REG_NAME VARCHAR(256),
REG_VERSION INTEGER NOT NULL,
REG_MEDIA_TYPE VARCHAR(500),
REG_CREATOR VARCHAR(31) NOT NULL,
REG_CREATED_TIME TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
REG_LAST_UPDATOR VARCHAR(31),
REG_LAST_UPDATED_TIME TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
REG_DESCRIPTION VARCHAR(1000),
REG_CONTENT_ID INTEGER,
REG_DELETED SMALLINT,
REG_TENANT_ID INTEGER DEFAULT 0,
REG_UUID VARCHAR(100) NOT NULL,
CONSTRAINT PK_REG_RESOURCE_HISTORY PRIMARY KEY(REG_VERSION, REG_TENANT_ID)
)ENGINE INNODB;
ALTER TABLE REG_RESOURCE_HISTORY ADD CONSTRAINT REG_RESOURCE_HIST_FK_BY_PATHID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
ALTER TABLE REG_RESOURCE_HISTORY ADD CONSTRAINT REG_RESOURCE_HIST_FK_BY_CONTENT_ID FOREIGN KEY (REG_CONTENT_ID, REG_TENANT_ID) REFERENCES REG_CONTENT_HISTORY (REG_CONTENT_ID, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_HISTORY_IND_BY_NAME USING HASH ON REG_RESOURCE_HISTORY(REG_NAME, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_HISTORY_IND_BY_PATH_ID_NAME USING HASH ON REG_RESOURCE(REG_PATH_ID, REG_NAME, REG_TENANT_ID);
CREATE TABLE IF NOT EXISTS REG_COMMENT (
REG_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_COMMENT_TEXT VARCHAR(500) NOT NULL,
REG_USER_ID VARCHAR(31) NOT NULL,
REG_COMMENTED_TIME TIMESTAMP NOT NULL,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_COMMENT PRIMARY KEY(REG_ID, REG_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS REG_RESOURCE_COMMENT (
REG_COMMENT_ID INTEGER NOT NULL,
REG_VERSION INTEGER,
REG_PATH_ID INTEGER,
REG_RESOURCE_NAME VARCHAR(256),
REG_TENANT_ID INTEGER DEFAULT 0
)ENGINE INNODB;
ALTER TABLE REG_RESOURCE_COMMENT ADD CONSTRAINT REG_RESOURCE_COMMENT_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
ALTER TABLE REG_RESOURCE_COMMENT ADD CONSTRAINT REG_RESOURCE_COMMENT_FK_BY_COMMENT_ID FOREIGN KEY (REG_COMMENT_ID, REG_TENANT_ID) REFERENCES REG_COMMENT (REG_ID, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_COMMENT_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_RESOURCE_COMMENT(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_COMMENT_IND_BY_VERSION USING HASH ON REG_RESOURCE_COMMENT(REG_VERSION, REG_TENANT_ID);
CREATE TABLE IF NOT EXISTS REG_RATING (
REG_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_RATING INTEGER NOT NULL,
REG_USER_ID VARCHAR(31) NOT NULL,
REG_RATED_TIME TIMESTAMP NOT NULL,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_RATING PRIMARY KEY(REG_ID, REG_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS REG_RESOURCE_RATING (
REG_RATING_ID INTEGER NOT NULL,
REG_VERSION INTEGER,
REG_PATH_ID INTEGER,
REG_RESOURCE_NAME VARCHAR(256),
REG_TENANT_ID INTEGER DEFAULT 0
)ENGINE INNODB;
ALTER TABLE REG_RESOURCE_RATING ADD CONSTRAINT REG_RESOURCE_RATING_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
ALTER TABLE REG_RESOURCE_RATING ADD CONSTRAINT REG_RESOURCE_RATING_FK_BY_RATING_ID FOREIGN KEY (REG_RATING_ID, REG_TENANT_ID) REFERENCES REG_RATING (REG_ID, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_RATING_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_RESOURCE_RATING(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_RATING_IND_BY_VERSION USING HASH ON REG_RESOURCE_RATING(REG_VERSION, REG_TENANT_ID);
CREATE TABLE IF NOT EXISTS REG_TAG (
REG_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_TAG_NAME VARCHAR(500) NOT NULL,
REG_USER_ID VARCHAR(31) NOT NULL,
REG_TAGGED_TIME TIMESTAMP NOT NULL,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_TAG PRIMARY KEY(REG_ID, REG_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS REG_RESOURCE_TAG (
REG_TAG_ID INTEGER NOT NULL,
REG_VERSION INTEGER,
REG_PATH_ID INTEGER,
REG_RESOURCE_NAME VARCHAR(256),
REG_TENANT_ID INTEGER DEFAULT 0
)ENGINE INNODB;
ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT REG_RESOURCE_TAG_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
ALTER TABLE REG_RESOURCE_TAG ADD CONSTRAINT REG_RESOURCE_TAG_FK_BY_TAG_ID FOREIGN KEY (REG_TAG_ID, REG_TENANT_ID) REFERENCES REG_TAG (REG_ID, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_TAG_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_RESOURCE_TAG(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_TAG_IND_BY_VERSION USING HASH ON REG_RESOURCE_TAG(REG_VERSION, REG_TENANT_ID);
CREATE TABLE IF NOT EXISTS REG_PROPERTY (
REG_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_NAME VARCHAR(100) NOT NULL,
REG_VALUE VARCHAR(1000),
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_PROPERTY PRIMARY KEY(REG_ID, REG_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS REG_RESOURCE_PROPERTY (
REG_PROPERTY_ID INTEGER NOT NULL,
REG_VERSION INTEGER,
REG_PATH_ID INTEGER,
REG_RESOURCE_NAME VARCHAR(256),
REG_TENANT_ID INTEGER DEFAULT 0
)ENGINE INNODB;
ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT REG_RESOURCE_PROPERTY_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
ALTER TABLE REG_RESOURCE_PROPERTY ADD CONSTRAINT REG_RESOURCE_PROPERTY_FK_BY_TAG_ID FOREIGN KEY (REG_PROPERTY_ID, REG_TENANT_ID) REFERENCES REG_PROPERTY (REG_ID, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_RESOURCE_PROPERTY(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
CREATE INDEX REG_RESOURCE_PROPERTY_IND_BY_VERSION USING HASH ON REG_RESOURCE_PROPERTY(REG_VERSION, REG_TENANT_ID);
-- CREATE TABLE IF NOT EXISTS REG_ASSOCIATIONS (
-- SRC_PATH_ID INTEGER,
-- SRC_RESOURCE_NAME VARCHAR(256),
-- SRC_VERSION INTEGER,
-- TGT_PATH_ID INTEGER,
-- TGT_RESOURCE_NAME VARCHAR(256),
-- TGT_VERSION INTEGER
-- )ENGINE INNODB;
--
-- ALTER TABLE REG_ASSOCIATIONS ADD CONSTRAINT REG_ASSOCIATIONS_FK_BY_SRC_PATH_ID FOREIGN KEY (SRC_PATH_ID) REFERENCES REG_PATH (PATH_ID);
-- ALTER TABLE REG_ASSOCIATIONS ADD CONSTRAINT REG_ASSOCIATIONS_FK_BY_TGT_PATH_ID FOREIGN KEY (TGT_PATH_ID) REFERENCES REG_PATH (PATH_ID);
-- CREATE INDEX REG_ASSOCIATIONS_IND_BY_SRC_VERSION ON REG_ASSOCIATIONS(SRC_VERSION);
-- CREATE INDEX REG_ASSOCIATIONS_IND_BY_TGT_VERSION ON REG_ASSOCIATIONS(TGT_VERSION);
-- CREATE INDEX REG_ASSOCIATIONS_IND_BY_SRC_RESOURCE_NAME ON REG_ASSOCIATIONS(SRC_RESOURCE_NAME);
-- CREATE INDEX REG_ASSOCIATIONS_IND_BY_TGT_RESOURCE_NAME ON REG_ASSOCIATIONS(TGT_RESOURCE_NAME);
CREATE TABLE IF NOT EXISTS REG_ASSOCIATION (
REG_ASSOCIATION_ID INTEGER AUTO_INCREMENT,
REG_SOURCEPATH VARCHAR (750) NOT NULL,
REG_TARGETPATH VARCHAR (750) NOT NULL,
REG_ASSOCIATION_TYPE VARCHAR (2000) NOT NULL,
REG_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (REG_ASSOCIATION_ID, REG_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS REG_SNAPSHOT (
REG_SNAPSHOT_ID INTEGER NOT NULL AUTO_INCREMENT,
REG_PATH_ID INTEGER NOT NULL,
REG_RESOURCE_NAME VARCHAR(255),
REG_RESOURCE_VIDS LONGBLOB NOT NULL,
REG_TENANT_ID INTEGER DEFAULT 0,
CONSTRAINT PK_REG_SNAPSHOT PRIMARY KEY(REG_SNAPSHOT_ID, REG_TENANT_ID)
)ENGINE INNODB;
CREATE INDEX REG_SNAPSHOT_IND_BY_PATH_ID_AND_RESOURCE_NAME USING HASH ON REG_SNAPSHOT(REG_PATH_ID, REG_RESOURCE_NAME, REG_TENANT_ID);
ALTER TABLE REG_SNAPSHOT ADD CONSTRAINT REG_SNAPSHOT_FK_BY_PATH_ID FOREIGN KEY (REG_PATH_ID, REG_TENANT_ID) REFERENCES REG_PATH (REG_PATH_ID, REG_TENANT_ID);
-- ################################
-- USER MANAGER TABLES
-- ################################
CREATE TABLE UM_TENANT (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_DOMAIN_NAME VARCHAR(255) NOT NULL,
UM_EMAIL VARCHAR(255),
UM_ACTIVE BOOLEAN DEFAULT FALSE,
UM_CREATED_DATE TIMESTAMP NOT NULL,
UM_USER_CONFIG LONGBLOB,
PRIMARY KEY (UM_ID),
UNIQUE(UM_DOMAIN_NAME)
)ENGINE INNODB;
CREATE TABLE UM_DOMAIN(
UM_DOMAIN_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_DOMAIN_NAME VARCHAR(255) NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_DOMAIN_ID, UM_TENANT_ID),
UNIQUE(UM_DOMAIN_NAME,UM_TENANT_ID)
)ENGINE INNODB;
CREATE UNIQUE INDEX INDEX_UM_TENANT_UM_DOMAIN_NAME
ON UM_TENANT (UM_DOMAIN_NAME);
CREATE TABLE UM_USER (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_ID VARCHAR(255) NOT NULL,
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_USER_PASSWORD VARCHAR(255) NOT NULL,
UM_SALT_VALUE VARCHAR(31),
UM_REQUIRE_CHANGE BOOLEAN DEFAULT FALSE,
UM_CHANGED_TIME TIMESTAMP NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_USER_ID, UM_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE UM_SYSTEM_USER (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_USER_PASSWORD VARCHAR(255) NOT NULL,
UM_SALT_VALUE VARCHAR(31),
UM_REQUIRE_CHANGE BOOLEAN DEFAULT FALSE,
UM_CHANGED_TIME TIMESTAMP NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_USER_NAME, UM_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE UM_ROLE (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_ROLE_NAME VARCHAR(255) NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UM_SHARED_ROLE BOOLEAN DEFAULT FALSE,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_ROLE_NAME, UM_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE UM_MODULE(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_MODULE_NAME VARCHAR(100),
UNIQUE(UM_MODULE_NAME),
PRIMARY KEY(UM_ID)
)ENGINE INNODB;
CREATE TABLE UM_MODULE_ACTIONS(
UM_ACTION VARCHAR(255) NOT NULL,
UM_MODULE_ID INTEGER NOT NULL,
PRIMARY KEY(UM_ACTION, UM_MODULE_ID),
FOREIGN KEY (UM_MODULE_ID) REFERENCES UM_MODULE(UM_ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE UM_PERMISSION (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_RESOURCE_ID VARCHAR(255) NOT NULL,
UM_ACTION VARCHAR(255) NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UM_MODULE_ID INTEGER DEFAULT 0,
UNIQUE(UM_RESOURCE_ID,UM_ACTION, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)ENGINE INNODB;
CREATE INDEX INDEX_UM_PERMISSION_UM_RESOURCE_ID_UM_ACTION ON UM_PERMISSION (UM_RESOURCE_ID, UM_ACTION, UM_TENANT_ID);
CREATE TABLE UM_ROLE_PERMISSION (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_PERMISSION_ID INTEGER NOT NULL,
UM_ROLE_NAME VARCHAR(255) NOT NULL,
UM_IS_ALLOWED SMALLINT NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UM_DOMAIN_ID INTEGER,
UNIQUE (UM_PERMISSION_ID, UM_ROLE_NAME, UM_TENANT_ID, UM_DOMAIN_ID),
FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)ENGINE INNODB;
-- REMOVED UNIQUE (UM_PERMISSION_ID, UM_ROLE_ID)
CREATE TABLE UM_USER_PERMISSION (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_PERMISSION_ID INTEGER NOT NULL,
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_IS_ALLOWED SMALLINT NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
FOREIGN KEY (UM_PERMISSION_ID, UM_TENANT_ID) REFERENCES UM_PERMISSION(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)ENGINE INNODB;
-- REMOVED UNIQUE (UM_PERMISSION_ID, UM_USER_ID)
CREATE TABLE UM_USER_ROLE (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_ROLE_ID INTEGER NOT NULL,
UM_USER_ID INTEGER NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UNIQUE (UM_USER_ID, UM_ROLE_ID, UM_TENANT_ID),
FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_ROLE(UM_ID, UM_TENANT_ID),
FOREIGN KEY (UM_USER_ID, UM_TENANT_ID) REFERENCES UM_USER(UM_ID, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE UM_SHARED_USER_ROLE(
UM_ROLE_ID INTEGER NOT NULL,
UM_USER_ID INTEGER NOT NULL,
UM_USER_TENANT_ID INTEGER NOT NULL,
UM_ROLE_TENANT_ID INTEGER NOT NULL,
UNIQUE(UM_USER_ID,UM_ROLE_ID,UM_USER_TENANT_ID, UM_ROLE_TENANT_ID),
FOREIGN KEY(UM_ROLE_ID,UM_ROLE_TENANT_ID) REFERENCES UM_ROLE(UM_ID,UM_TENANT_ID) ON DELETE CASCADE,
FOREIGN KEY(UM_USER_ID,UM_USER_TENANT_ID) REFERENCES UM_USER(UM_ID,UM_TENANT_ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE UM_ACCOUNT_MAPPING(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_TENANT_ID INTEGER NOT NULL,
UM_USER_STORE_DOMAIN VARCHAR(100),
UM_ACC_LINK_ID INTEGER NOT NULL,
UNIQUE(UM_USER_NAME, UM_TENANT_ID, UM_USER_STORE_DOMAIN, UM_ACC_LINK_ID),
FOREIGN KEY (UM_TENANT_ID) REFERENCES UM_TENANT(UM_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID)
)ENGINE INNODB;
CREATE TABLE UM_USER_ATTRIBUTE (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_ATTR_NAME VARCHAR(255) NOT NULL,
UM_ATTR_VALUE VARCHAR(1024),
UM_PROFILE_ID VARCHAR(255),
UM_USER_ID INTEGER,
UM_TENANT_ID INTEGER DEFAULT 0,
FOREIGN KEY (UM_USER_ID, UM_TENANT_ID) REFERENCES UM_USER(UM_ID, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)ENGINE INNODB;
CREATE INDEX UM_USER_ID_INDEX ON UM_USER_ATTRIBUTE(UM_USER_ID);
CREATE TABLE UM_DIALECT(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_DIALECT_URI VARCHAR(255) NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UNIQUE(UM_DIALECT_URI, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE UM_CLAIM(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_DIALECT_ID INTEGER NOT NULL,
UM_CLAIM_URI VARCHAR(255) NOT NULL,
UM_DISPLAY_TAG VARCHAR(255),
UM_DESCRIPTION VARCHAR(255),
UM_MAPPED_ATTRIBUTE_DOMAIN VARCHAR(255),
UM_MAPPED_ATTRIBUTE VARCHAR(255),
UM_REG_EX VARCHAR(255),
UM_SUPPORTED SMALLINT,
UM_REQUIRED SMALLINT,
UM_DISPLAY_ORDER INTEGER,
UM_CHECKED_ATTRIBUTE SMALLINT,
UM_READ_ONLY SMALLINT,
UM_TENANT_ID INTEGER DEFAULT 0,
UNIQUE(UM_DIALECT_ID, UM_CLAIM_URI, UM_TENANT_ID,UM_MAPPED_ATTRIBUTE_DOMAIN),
FOREIGN KEY(UM_DIALECT_ID, UM_TENANT_ID) REFERENCES UM_DIALECT(UM_ID, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE UM_PROFILE_CONFIG(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_DIALECT_ID INTEGER NOT NULL,
UM_PROFILE_NAME VARCHAR(255),
UM_TENANT_ID INTEGER DEFAULT 0,
FOREIGN KEY(UM_DIALECT_ID, UM_TENANT_ID) REFERENCES UM_DIALECT(UM_ID, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS UM_CLAIM_BEHAVIOR(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_PROFILE_ID INTEGER,
UM_CLAIM_ID INTEGER,
UM_BEHAVIOUR SMALLINT,
UM_TENANT_ID INTEGER DEFAULT 0,
FOREIGN KEY(UM_PROFILE_ID, UM_TENANT_ID) REFERENCES UM_PROFILE_CONFIG(UM_ID,UM_TENANT_ID),
FOREIGN KEY(UM_CLAIM_ID, UM_TENANT_ID) REFERENCES UM_CLAIM(UM_ID,UM_TENANT_ID),
PRIMARY KEY(UM_ID, UM_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE UM_HYBRID_ROLE(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_ROLE_NAME VARCHAR(255) NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_ROLE_NAME,UM_TENANT_ID)
)ENGINE INNODB;
CREATE INDEX UM_ROLE_NAME_IND ON UM_HYBRID_ROLE(UM_ROLE_NAME);
CREATE TABLE UM_HYBRID_USER_ROLE(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_NAME VARCHAR(255),
UM_ROLE_ID INTEGER NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UM_DOMAIN_ID INTEGER,
UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID, UM_DOMAIN_ID),
FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE,
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE UM_SYSTEM_ROLE(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_ROLE_NAME VARCHAR(255) NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID),
UNIQUE(UM_ROLE_NAME,UM_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE UM_SYSTEM_USER_ROLE(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_NAME VARCHAR(255),
UM_ROLE_ID INTEGER NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
UNIQUE (UM_USER_NAME, UM_ROLE_ID, UM_TENANT_ID),
FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_SYSTEM_ROLE(UM_ID, UM_TENANT_ID),
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE UM_HYBRID_REMEMBER_ME(
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_NAME VARCHAR(255) NOT NULL,
UM_COOKIE_VALUE VARCHAR(1024),
UM_CREATED_TIME TIMESTAMP,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID, UM_TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS UM_UUID_DOMAIN_MAPPER (
UM_ID INTEGER NOT NULL AUTO_INCREMENT,
UM_USER_ID VARCHAR(255) NOT NULL,
UM_DOMAIN_ID INTEGER NOT NULL,
UM_TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (UM_ID),
UNIQUE (UM_USER_ID),
FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE INDEX UUID_DM_UID_TID ON UM_UUID_DOMAIN_MAPPER(UM_USER_ID, UM_TENANT_ID);
-- APIMGT DB --
USE WSO2AM_APIMGT_DB;
-- Start of IDENTITY Tables--
CREATE TABLE IF NOT EXISTS IDN_BASE_TABLE (
PRODUCT_NAME VARCHAR(20),
PRIMARY KEY (PRODUCT_NAME)
)ENGINE INNODB;
INSERT INTO IDN_BASE_TABLE values ('WSO2 Identity Server');
CREATE TABLE IF NOT EXISTS IDN_OAUTH_CONSUMER_APPS (
ID INTEGER NOT NULL AUTO_INCREMENT,
CONSUMER_KEY VARCHAR(255),
CONSUMER_SECRET VARCHAR(2048),
USERNAME VARCHAR(255),
TENANT_ID INTEGER DEFAULT 0,
USER_DOMAIN VARCHAR(50),
APP_NAME VARCHAR(255),
OAUTH_VERSION VARCHAR(128),
CALLBACK_URL VARCHAR(2048),
GRANT_TYPES VARCHAR (1024),
PKCE_MANDATORY CHAR(1) DEFAULT '0',
PKCE_SUPPORT_PLAIN CHAR(1) DEFAULT '0',
APP_STATE VARCHAR (25) DEFAULT 'ACTIVE',
USER_ACCESS_TOKEN_EXPIRE_TIME BIGINT DEFAULT 3600,
APP_ACCESS_TOKEN_EXPIRE_TIME BIGINT DEFAULT 3600,
REFRESH_TOKEN_EXPIRE_TIME BIGINT DEFAULT 84600,
ID_TOKEN_EXPIRE_TIME BIGINT DEFAULT 3600,
CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (CONSUMER_KEY),
PRIMARY KEY (ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE_VALIDATORS (
APP_ID INTEGER NOT NULL,
SCOPE_VALIDATOR VARCHAR (128) NOT NULL,
PRIMARY KEY (APP_ID,SCOPE_VALIDATOR),
FOREIGN KEY (APP_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH1A_REQUEST_TOKEN (
REQUEST_TOKEN VARCHAR(255),
REQUEST_TOKEN_SECRET VARCHAR(512),
CONSUMER_KEY_ID INTEGER,
CALLBACK_URL VARCHAR(2048),
SCOPE VARCHAR(2048),
AUTHORIZED VARCHAR(128),
OAUTH_VERIFIER VARCHAR(512),
AUTHZ_USER VARCHAR(512),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (REQUEST_TOKEN),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH1A_ACCESS_TOKEN (
ACCESS_TOKEN VARCHAR(255),
ACCESS_TOKEN_SECRET VARCHAR(512),
CONSUMER_KEY_ID INTEGER,
SCOPE VARCHAR(2048),
AUTHZ_USER VARCHAR(512),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (ACCESS_TOKEN),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN (
TOKEN_ID VARCHAR (255),
ACCESS_TOKEN VARCHAR(2048),
REFRESH_TOKEN VARCHAR(2048),
CONSUMER_KEY_ID INTEGER,
AUTHZ_USER VARCHAR (100),
TENANT_ID INTEGER,
USER_DOMAIN VARCHAR(50),
USER_TYPE VARCHAR (25),
GRANT_TYPE VARCHAR (50),
TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
REFRESH_TOKEN_TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
VALIDITY_PERIOD BIGINT,
REFRESH_TOKEN_VALIDITY_PERIOD BIGINT,
TOKEN_SCOPE_HASH VARCHAR(32),
TOKEN_STATE VARCHAR(25) DEFAULT 'ACTIVE',
TOKEN_STATE_ID VARCHAR (128) DEFAULT 'NONE',
SUBJECT_IDENTIFIER VARCHAR(255),
ACCESS_TOKEN_HASH VARCHAR(512),
REFRESH_TOKEN_HASH VARCHAR(512),
IDP_ID INTEGER DEFAULT -1 NOT NULL,
TOKEN_BINDING_REF VARCHAR (32) DEFAULT 'NONE',
PRIMARY KEY (TOKEN_ID),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE,
CONSTRAINT CON_APP_KEY UNIQUE (CONSUMER_KEY_ID,AUTHZ_USER,TENANT_ID,USER_DOMAIN,USER_TYPE,TOKEN_SCOPE_HASH,
TOKEN_STATE,TOKEN_STATE_ID,IDP_ID,TOKEN_BINDING_REF)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_TOKEN_BINDING (
TOKEN_ID VARCHAR (255),
TOKEN_BINDING_TYPE VARCHAR (32),
TOKEN_BINDING_REF VARCHAR (32),
TOKEN_BINDING_VALUE VARCHAR (1024),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (TOKEN_ID),
FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN_AUDIT (
TOKEN_ID VARCHAR (255),
ACCESS_TOKEN VARCHAR(2048),
REFRESH_TOKEN VARCHAR(2048),
CONSUMER_KEY_ID INTEGER,
AUTHZ_USER VARCHAR (100),
TENANT_ID INTEGER,
USER_DOMAIN VARCHAR(50),
USER_TYPE VARCHAR (25),
GRANT_TYPE VARCHAR (50),
TIME_CREATED TIMESTAMP NULL,
REFRESH_TOKEN_TIME_CREATED TIMESTAMP NULL,
VALIDITY_PERIOD BIGINT,
REFRESH_TOKEN_VALIDITY_PERIOD BIGINT,
TOKEN_SCOPE_HASH VARCHAR(32),
TOKEN_STATE VARCHAR(25),
TOKEN_STATE_ID VARCHAR (128) ,
SUBJECT_IDENTIFIER VARCHAR(255),
ACCESS_TOKEN_HASH VARCHAR(512),
REFRESH_TOKEN_HASH VARCHAR(512),
INVALIDATED_TIME TIMESTAMP NULL,
IDP_ID INTEGER DEFAULT -1 NOT NULL
);
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_AUTHORIZATION_CODE (
CODE_ID VARCHAR (255),
AUTHORIZATION_CODE VARCHAR(2048),
CONSUMER_KEY_ID INTEGER,
CALLBACK_URL VARCHAR(2048),
SCOPE VARCHAR(2048),
AUTHZ_USER VARCHAR (100),
TENANT_ID INTEGER,
USER_DOMAIN VARCHAR(50),
TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
VALIDITY_PERIOD BIGINT,
STATE VARCHAR (25) DEFAULT 'ACTIVE',
TOKEN_ID VARCHAR(255),
SUBJECT_IDENTIFIER VARCHAR(255),
PKCE_CODE_CHALLENGE VARCHAR(255),
PKCE_CODE_CHALLENGE_METHOD VARCHAR(128),
AUTHORIZATION_CODE_HASH VARCHAR(512),
IDP_ID INTEGER DEFAULT -1 NOT NULL,
PRIMARY KEY (CODE_ID),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_AUTHZ_CODE_SCOPE(
CODE_ID VARCHAR(255),
SCOPE VARCHAR(60),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (CODE_ID, SCOPE),
FOREIGN KEY (CODE_ID) REFERENCES IDN_OAUTH2_AUTHORIZATION_CODE (CODE_ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_DEVICE_FLOW (
CODE_ID VARCHAR(255),
DEVICE_CODE VARCHAR(255),
USER_CODE VARCHAR(25),
CONSUMER_KEY_ID INTEGER,
LAST_POLL_TIME TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
EXPIRY_TIME TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
POLL_TIME BIGINT,
STATUS VARCHAR (25) DEFAULT 'PENDING',
AUTHZ_USER VARCHAR (100),
TENANT_ID INTEGER,
USER_DOMAIN VARCHAR(50),
IDP_ID INTEGER,
PRIMARY KEY (DEVICE_CODE),
UNIQUE (CODE_ID),
UNIQUE (USER_CODE),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_DEVICE_FLOW_SCOPES (
ID INTEGER NOT NULL AUTO_INCREMENT,
SCOPE_ID VARCHAR(255),
SCOPE VARCHAR(255),
PRIMARY KEY (ID),
FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_DEVICE_FLOW(CODE_ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN_SCOPE (
TOKEN_ID VARCHAR (255),
TOKEN_SCOPE VARCHAR (60),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (TOKEN_ID, TOKEN_SCOPE),
FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE (
SCOPE_ID INTEGER NOT NULL AUTO_INCREMENT,
NAME VARCHAR(255) NOT NULL,
DISPLAY_NAME VARCHAR(255) NOT NULL,
DESCRIPTION VARCHAR(512),
TENANT_ID INTEGER NOT NULL DEFAULT -1,
SCOPE_TYPE VARCHAR(255) NOT NULL,
PRIMARY KEY (SCOPE_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE_BINDING (
SCOPE_ID INTEGER NOT NULL,
SCOPE_BINDING VARCHAR(255) NOT NULL,
BINDING_TYPE VARCHAR(255) NOT NULL,
FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_RESOURCE_SCOPE (
RESOURCE_PATH VARCHAR(255) NOT NULL,
SCOPE_ID INTEGER NOT NULL,
TENANT_ID INTEGER DEFAULT -1,
FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_SCIM_GROUP (
ID INTEGER AUTO_INCREMENT,
TENANT_ID INTEGER NOT NULL,
ROLE_NAME VARCHAR(255) NOT NULL,
ATTR_NAME VARCHAR(1024) NOT NULL,
ATTR_VALUE VARCHAR(1024),
PRIMARY KEY (ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OPENID_REMEMBER_ME (
USER_NAME VARCHAR(255) NOT NULL,
TENANT_ID INTEGER DEFAULT 0,
COOKIE_VALUE VARCHAR(1024),
CREATED_TIME TIMESTAMP,
PRIMARY KEY (USER_NAME, TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OPENID_USER_RPS (
USER_NAME VARCHAR(255) NOT NULL,
TENANT_ID INTEGER DEFAULT 0,
RP_URL VARCHAR(255) NOT NULL,
TRUSTED_ALWAYS VARCHAR(128) DEFAULT 'FALSE',
LAST_VISIT DATE NOT NULL,
VISIT_COUNT INTEGER DEFAULT 0,
DEFAULT_PROFILE_NAME VARCHAR(255) DEFAULT 'DEFAULT',
PRIMARY KEY (USER_NAME, TENANT_ID, RP_URL)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OPENID_ASSOCIATIONS (
HANDLE VARCHAR(255) NOT NULL,
ASSOC_TYPE VARCHAR(255) NOT NULL,
EXPIRE_IN TIMESTAMP NOT NULL,
MAC_KEY VARCHAR(255) NOT NULL,
ASSOC_STORE VARCHAR(128) DEFAULT 'SHARED',
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (HANDLE)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_STS_STORE (
ID INTEGER AUTO_INCREMENT,
TOKEN_ID VARCHAR(255) NOT NULL,
TOKEN_CONTENT BLOB(1024) NOT NULL,
CREATE_DATE TIMESTAMP NOT NULL,
EXPIRE_DATE TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
STATE INTEGER DEFAULT 0,
PRIMARY KEY (ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_IDENTITY_USER_DATA (
TENANT_ID INTEGER DEFAULT -1234,
USER_NAME VARCHAR(255) NOT NULL,
DATA_KEY VARCHAR(255) NOT NULL,
DATA_VALUE VARCHAR(2048),
PRIMARY KEY (TENANT_ID, USER_NAME, DATA_KEY)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_IDENTITY_META_DATA (
USER_NAME VARCHAR(255) NOT NULL,
TENANT_ID INTEGER DEFAULT -1234,
METADATA_TYPE VARCHAR(255) NOT NULL,
METADATA VARCHAR(255) NOT NULL,
VALID VARCHAR(255) NOT NULL,
PRIMARY KEY (TENANT_ID, USER_NAME, METADATA_TYPE,METADATA)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_THRIFT_SESSION (
SESSION_ID VARCHAR(255) NOT NULL,
USER_NAME VARCHAR(255) NOT NULL,
CREATED_TIME VARCHAR(255) NOT NULL,
LAST_MODIFIED_TIME VARCHAR(255) NOT NULL,
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (SESSION_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_AUTH_SESSION_STORE (
SESSION_ID VARCHAR (100) NOT NULL,
SESSION_TYPE VARCHAR(100) NOT NULL,
OPERATION VARCHAR(10) NOT NULL,
SESSION_OBJECT BLOB,
TIME_CREATED BIGINT,
TENANT_ID INTEGER DEFAULT -1,
EXPIRY_TIME BIGINT,
PRIMARY KEY (SESSION_ID, SESSION_TYPE, TIME_CREATED, OPERATION)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_AUTH_TEMP_SESSION_STORE (
SESSION_ID VARCHAR (100) NOT NULL,
SESSION_TYPE VARCHAR(100) NOT NULL,
OPERATION VARCHAR(10) NOT NULL,
SESSION_OBJECT BLOB,
TIME_CREATED BIGINT,
TENANT_ID INTEGER DEFAULT -1,
EXPIRY_TIME BIGINT,
PRIMARY KEY (SESSION_ID, SESSION_TYPE, TIME_CREATED, OPERATION)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_AUTH_USER (
USER_ID VARCHAR(255) NOT NULL,
USER_NAME VARCHAR(255) NOT NULL,
TENANT_ID INTEGER NOT NULL,
DOMAIN_NAME VARCHAR(255) NOT NULL,
IDP_ID INTEGER NOT NULL,
PRIMARY KEY (USER_ID),
CONSTRAINT USER_STORE_CONSTRAINT UNIQUE (USER_NAME, TENANT_ID, DOMAIN_NAME, IDP_ID));
CREATE TABLE IF NOT EXISTS IDN_AUTH_USER_SESSION_MAPPING (
USER_ID VARCHAR(255) NOT NULL,
SESSION_ID VARCHAR(255) NOT NULL,
CONSTRAINT USER_SESSION_STORE_CONSTRAINT UNIQUE (USER_ID, SESSION_ID));
CREATE TABLE IF NOT EXISTS IDN_AUTH_SESSION_APP_INFO (
SESSION_ID VARCHAR (100) NOT NULL,
SUBJECT VARCHAR (100) NOT NULL,
APP_ID INTEGER NOT NULL,
INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL,
PRIMARY KEY (SESSION_ID, SUBJECT, APP_ID, INBOUND_AUTH_TYPE)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_AUTH_SESSION_META_DATA (
SESSION_ID VARCHAR (100) NOT NULL,
PROPERTY_TYPE VARCHAR (100) NOT NULL,
VALUE VARCHAR (255) NOT NULL,
PRIMARY KEY (SESSION_ID, PROPERTY_TYPE, VALUE)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS SP_APP (
ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID INTEGER NOT NULL,
APP_NAME VARCHAR (255) NOT NULL ,
USER_STORE VARCHAR (255) NOT NULL,
USERNAME VARCHAR (255) NOT NULL ,
DESCRIPTION VARCHAR (1024),
ROLE_CLAIM VARCHAR (512),
AUTH_TYPE VARCHAR (255) NOT NULL,
PROVISIONING_USERSTORE_DOMAIN VARCHAR (512),
IS_LOCAL_CLAIM_DIALECT CHAR(1) DEFAULT '1',
IS_SEND_LOCAL_SUBJECT_ID CHAR(1) DEFAULT '0',
IS_SEND_AUTH_LIST_OF_IDPS CHAR(1) DEFAULT '0',
IS_USE_TENANT_DOMAIN_SUBJECT CHAR(1) DEFAULT '1',
IS_USE_USER_DOMAIN_SUBJECT CHAR(1) DEFAULT '1',
ENABLE_AUTHORIZATION CHAR(1) DEFAULT '0',
SUBJECT_CLAIM_URI VARCHAR (512),
IS_SAAS_APP CHAR(1) DEFAULT '0',
IS_DUMB_MODE CHAR(1) DEFAULT '0',
UUID CHAR(36),
IMAGE_URL VARCHAR(1024),
ACCESS_URL VARCHAR(1024),
IS_DISCOVERABLE CHAR(1) DEFAULT '0',
PRIMARY KEY (ID)
)ENGINE INNODB;
ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_NAME_CONSTRAINT UNIQUE(APP_NAME, TENANT_ID);
ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_UUID_CONSTRAINT UNIQUE(UUID);
CREATE TABLE IF NOT EXISTS SP_METADATA (
ID INTEGER AUTO_INCREMENT,
SP_ID INTEGER,
NAME VARCHAR(255) NOT NULL,
VALUE VARCHAR(255) NOT NULL,
DISPLAY_NAME VARCHAR(255),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (ID),
CONSTRAINT SP_METADATA_CONSTRAINT UNIQUE (SP_ID, NAME),
FOREIGN KEY (SP_ID) REFERENCES SP_APP(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS SP_INBOUND_AUTH (
ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID INTEGER NOT NULL,
INBOUND_AUTH_KEY VARCHAR (255),
INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL,
INBOUND_CONFIG_TYPE VARCHAR (255) NOT NULL,
PROP_NAME VARCHAR (255),
PROP_VALUE VARCHAR (1024) ,
APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID)
)ENGINE INNODB;
ALTER TABLE SP_INBOUND_AUTH ADD CONSTRAINT APPLICATION_ID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
CREATE TABLE IF NOT EXISTS SP_AUTH_STEP (
ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID INTEGER NOT NULL,
STEP_ORDER INTEGER DEFAULT 1,
APP_ID INTEGER NOT NULL ,
IS_SUBJECT_STEP CHAR(1) DEFAULT '0',
IS_ATTRIBUTE_STEP CHAR(1) DEFAULT '0',
PRIMARY KEY (ID)
)ENGINE INNODB;
ALTER TABLE SP_AUTH_STEP ADD CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
CREATE TABLE IF NOT EXISTS SP_FEDERATED_IDP (
ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL,
AUTHENTICATOR_ID INTEGER NOT NULL,
PRIMARY KEY (ID, AUTHENTICATOR_ID)
)ENGINE INNODB;
ALTER TABLE SP_FEDERATED_IDP ADD CONSTRAINT STEP_ID_CONSTRAINT FOREIGN KEY (ID) REFERENCES SP_AUTH_STEP (ID) ON DELETE CASCADE;
CREATE TABLE IF NOT EXISTS SP_CLAIM_DIALECT (
ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID INTEGER NOT NULL,
SP_DIALECT VARCHAR (512) NOT NULL,
APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID));
ALTER TABLE SP_CLAIM_DIALECT ADD CONSTRAINT DIALECTID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
CREATE TABLE IF NOT EXISTS SP_CLAIM_MAPPING (
ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID INTEGER NOT NULL,
IDP_CLAIM VARCHAR (512) NOT NULL ,
SP_CLAIM VARCHAR (512) NOT NULL ,
APP_ID INTEGER NOT NULL,
IS_REQUESTED VARCHAR(128) DEFAULT '0',
IS_MANDATORY VARCHAR(128) DEFAULT '0',
DEFAULT_VALUE VARCHAR(255),
PRIMARY KEY (ID)
)ENGINE INNODB;
ALTER TABLE SP_CLAIM_MAPPING ADD CONSTRAINT CLAIMID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
CREATE TABLE IF NOT EXISTS SP_ROLE_MAPPING (
ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID INTEGER NOT NULL,
IDP_ROLE VARCHAR (255) NOT NULL ,
SP_ROLE VARCHAR (255) NOT NULL ,
APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID)
)ENGINE INNODB;
ALTER TABLE SP_ROLE_MAPPING ADD CONSTRAINT ROLEID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
CREATE TABLE IF NOT EXISTS SP_REQ_PATH_AUTHENTICATOR (
ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID INTEGER NOT NULL,
AUTHENTICATOR_NAME VARCHAR (255) NOT NULL ,
APP_ID INTEGER NOT NULL,
PRIMARY KEY (ID)
)ENGINE INNODB;
ALTER TABLE SP_REQ_PATH_AUTHENTICATOR ADD CONSTRAINT REQ_AUTH_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
CREATE TABLE IF NOT EXISTS SP_PROVISIONING_CONNECTOR (
ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID INTEGER NOT NULL,
IDP_NAME VARCHAR (255) NOT NULL ,
CONNECTOR_NAME VARCHAR (255) NOT NULL ,
APP_ID INTEGER NOT NULL,
IS_JIT_ENABLED CHAR(1) NOT NULL DEFAULT '0',
BLOCKING CHAR(1) NOT NULL DEFAULT '0',
RULE_ENABLED CHAR(1) NOT NULL DEFAULT '0',
PRIMARY KEY (ID)
)ENGINE INNODB;
ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE;
CREATE TABLE SP_AUTH_SCRIPT (
ID INTEGER AUTO_INCREMENT NOT NULL,
TENANT_ID INTEGER NOT NULL,
APP_ID INTEGER NOT NULL,
TYPE VARCHAR(255) NOT NULL,
CONTENT BLOB DEFAULT NULL,
IS_ENABLED CHAR(1) NOT NULL DEFAULT '0',
PRIMARY KEY (ID));
CREATE TABLE IF NOT EXISTS SP_TEMPLATE (
ID INTEGER AUTO_INCREMENT NOT NULL,
TENANT_ID INTEGER NOT NULL,
NAME VARCHAR(255) NOT NULL,
DESCRIPTION VARCHAR(1023),
CONTENT BLOB DEFAULT NULL,
PRIMARY KEY (ID),
CONSTRAINT SP_TEMPLATE_CONSTRAINT UNIQUE (TENANT_ID, NAME));
CREATE TABLE IF NOT EXISTS IDN_AUTH_WAIT_STATUS (
ID INTEGER AUTO_INCREMENT NOT NULL,
TENANT_ID INTEGER NOT NULL,
LONG_WAIT_KEY VARCHAR(255) NOT NULL,
WAIT_STATUS CHAR(1) NOT NULL DEFAULT '1',
TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
EXPIRE_TIME TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (ID),
CONSTRAINT IDN_AUTH_WAIT_STATUS_KEY UNIQUE (LONG_WAIT_KEY));
CREATE TABLE IF NOT EXISTS IDP (
ID INTEGER AUTO_INCREMENT,
TENANT_ID INTEGER,
NAME VARCHAR(254) NOT NULL,
IS_ENABLED CHAR(1) NOT NULL DEFAULT '1',
IS_PRIMARY CHAR(1) NOT NULL DEFAULT '0',
HOME_REALM_ID VARCHAR(254),
IMAGE MEDIUMBLOB,
CERTIFICATE BLOB,
ALIAS VARCHAR(254),
INBOUND_PROV_ENABLED CHAR (1) NOT NULL DEFAULT '0',
INBOUND_PROV_USER_STORE_ID VARCHAR(254),
USER_CLAIM_URI VARCHAR(254),
ROLE_CLAIM_URI VARCHAR(254),
DESCRIPTION VARCHAR (1024),
DEFAULT_AUTHENTICATOR_NAME VARCHAR(254),
DEFAULT_PRO_CONNECTOR_NAME VARCHAR(254),
PROVISIONING_ROLE VARCHAR(128),
IS_FEDERATION_HUB CHAR(1) NOT NULL DEFAULT '0',
IS_LOCAL_CLAIM_DIALECT CHAR(1) NOT NULL DEFAULT '0',
DISPLAY_NAME VARCHAR(255),
IMAGE_URL VARCHAR(1024),
UUID CHAR(36) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, NAME),
UNIQUE (UUID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDP_ROLE (
ID INTEGER AUTO_INCREMENT,
IDP_ID INTEGER,
TENANT_ID INTEGER,
ROLE VARCHAR(254),
PRIMARY KEY (ID),
UNIQUE (IDP_ID, ROLE),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDP_ROLE_MAPPING (
ID INTEGER AUTO_INCREMENT,
IDP_ROLE_ID INTEGER,
TENANT_ID INTEGER,
USER_STORE_ID VARCHAR (253),
LOCAL_ROLE VARCHAR(253),
PRIMARY KEY (ID),
UNIQUE (IDP_ROLE_ID, TENANT_ID, USER_STORE_ID, LOCAL_ROLE),
FOREIGN KEY (IDP_ROLE_ID) REFERENCES IDP_ROLE(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDP_CLAIM (
ID INTEGER AUTO_INCREMENT,
IDP_ID INTEGER,
TENANT_ID INTEGER,
CLAIM VARCHAR(254),
PRIMARY KEY (ID),
UNIQUE (IDP_ID, CLAIM),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDP_CLAIM_MAPPING (
ID INTEGER AUTO_INCREMENT,
IDP_CLAIM_ID INTEGER,
TENANT_ID INTEGER,
LOCAL_CLAIM VARCHAR(253),
DEFAULT_VALUE VARCHAR(255),
IS_REQUESTED VARCHAR(128) DEFAULT '0',
PRIMARY KEY (ID),
UNIQUE (IDP_CLAIM_ID, TENANT_ID, LOCAL_CLAIM),
FOREIGN KEY (IDP_CLAIM_ID) REFERENCES IDP_CLAIM(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR (
ID INTEGER AUTO_INCREMENT,
TENANT_ID INTEGER,
IDP_ID INTEGER,
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDP_METADATA (
ID INTEGER AUTO_INCREMENT,
IDP_ID INTEGER,
NAME VARCHAR(255) NOT NULL,
VALUE VARCHAR(255) NOT NULL,
DISPLAY_NAME VARCHAR(255),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (ID),
CONSTRAINT IDP_METADATA_CONSTRAINT UNIQUE (IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR_PROPERTY (
ID INTEGER AUTO_INCREMENT,
TENANT_ID INTEGER,
AUTHENTICATOR_ID INTEGER,
PROPERTY_KEY VARCHAR(255) NOT NULL,
PROPERTY_VALUE VARCHAR(2047),
IS_SECRET CHAR (1) DEFAULT '0',
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY),
FOREIGN KEY (AUTHENTICATOR_ID) REFERENCES IDP_AUTHENTICATOR(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDP_PROVISIONING_CONFIG (
ID INTEGER AUTO_INCREMENT,
TENANT_ID INTEGER,
IDP_ID INTEGER,
PROVISIONING_CONNECTOR_TYPE VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '0',
IS_BLOCKING CHAR (1) DEFAULT '0',
IS_RULES_ENABLED CHAR (1) DEFAULT '0',
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, PROVISIONING_CONNECTOR_TYPE),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDP_PROV_CONFIG_PROPERTY (
ID INTEGER AUTO_INCREMENT,
TENANT_ID INTEGER,
PROVISIONING_CONFIG_ID INTEGER,
PROPERTY_KEY VARCHAR(255) NOT NULL,
PROPERTY_VALUE VARCHAR(2048),
PROPERTY_BLOB_VALUE BLOB,
PROPERTY_TYPE CHAR(32) NOT NULL,
IS_SECRET CHAR (1) DEFAULT '0',
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, PROVISIONING_CONFIG_ID, PROPERTY_KEY),
FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDP_PROVISIONING_ENTITY (
ID INTEGER AUTO_INCREMENT,
PROVISIONING_CONFIG_ID INTEGER,
ENTITY_TYPE VARCHAR(255) NOT NULL,
ENTITY_LOCAL_USERSTORE VARCHAR(255) NOT NULL,
ENTITY_NAME VARCHAR(255) NOT NULL,
ENTITY_VALUE VARCHAR(255),
TENANT_ID INTEGER,
ENTITY_LOCAL_ID VARCHAR(255),
PRIMARY KEY (ID),
UNIQUE (ENTITY_TYPE, TENANT_ID, ENTITY_LOCAL_USERSTORE, ENTITY_NAME, PROVISIONING_CONFIG_ID),
UNIQUE (PROVISIONING_CONFIG_ID, ENTITY_TYPE, ENTITY_VALUE),
FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDP_LOCAL_CLAIM (
ID INTEGER AUTO_INCREMENT,
TENANT_ID INTEGER,
IDP_ID INTEGER,
CLAIM_URI VARCHAR(255) NOT NULL,
DEFAULT_VALUE VARCHAR(255),
IS_REQUESTED VARCHAR(128) DEFAULT '0',
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, CLAIM_URI),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_ASSOCIATED_ID (
ID INTEGER AUTO_INCREMENT,
IDP_USER_ID VARCHAR(255) NOT NULL,
TENANT_ID INTEGER DEFAULT -1234,
IDP_ID INTEGER NOT NULL,
DOMAIN_NAME VARCHAR(255) NOT NULL,
USER_NAME VARCHAR(255) NOT NULL,
ASSOCIATION_ID CHAR(36) NOT NULL,
PRIMARY KEY (ID),
UNIQUE(IDP_USER_ID, TENANT_ID, IDP_ID),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_USER_ACCOUNT_ASSOCIATION (
ASSOCIATION_KEY VARCHAR(255) NOT NULL,
TENANT_ID INTEGER,
DOMAIN_NAME VARCHAR(255) NOT NULL,
USER_NAME VARCHAR(255) NOT NULL,
PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS FIDO_DEVICE_STORE (
TENANT_ID INTEGER,
DOMAIN_NAME VARCHAR(255) NOT NULL,
USER_NAME VARCHAR(45) NOT NULL,
TIME_REGISTERED TIMESTAMP,
KEY_HANDLE VARCHAR(200) NOT NULL,
DEVICE_DATA VARCHAR(2048) NOT NULL,
PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME, KEY_HANDLE)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS FIDO2_DEVICE_STORE (
TENANT_ID INTEGER,
DOMAIN_NAME VARCHAR(255) NOT NULL,
USER_NAME VARCHAR(45) NOT NULL,
TIME_REGISTERED TIMESTAMP,
USER_HANDLE VARCHAR(64) NOT NULL,
CREDENTIAL_ID VARCHAR(200) NOT NULL,
PUBLIC_KEY_COSE VARCHAR(1024) NOT NULL,
SIGNATURE_COUNT BIGINT,
USER_IDENTITY VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(255),
IS_USERNAMELESS_SUPPORTED CHAR(1) DEFAULT '0',
PRIMARY KEY (CREDENTIAL_ID, USER_HANDLE)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS WF_REQUEST (
UUID VARCHAR (45),
CREATED_BY VARCHAR (255),
TENANT_ID INTEGER DEFAULT -1,
OPERATION_TYPE VARCHAR (50),
CREATED_AT TIMESTAMP,
UPDATED_AT TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
STATUS VARCHAR (30),
REQUEST BLOB,
PRIMARY KEY (UUID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS WF_BPS_PROFILE (
PROFILE_NAME VARCHAR(45),
HOST_URL_MANAGER VARCHAR(255),
HOST_URL_WORKER VARCHAR(255),
USERNAME VARCHAR(45),
PASSWORD VARCHAR(1023),
CALLBACK_HOST VARCHAR (45),
CALLBACK_USERNAME VARCHAR (45),
CALLBACK_PASSWORD VARCHAR (255),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (PROFILE_NAME, TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS WF_WORKFLOW(
ID VARCHAR (45),
WF_NAME VARCHAR (45),
DESCRIPTION VARCHAR (255),
TEMPLATE_ID VARCHAR (45),
IMPL_ID VARCHAR (45),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS WF_WORKFLOW_ASSOCIATION(
ID INTEGER NOT NULL AUTO_INCREMENT,
ASSOC_NAME VARCHAR (45),
EVENT_ID VARCHAR(45),
ASSOC_CONDITION VARCHAR (2000),
WORKFLOW_ID VARCHAR (45),
IS_ENABLED CHAR (1) DEFAULT '1',
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY(ID),
FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS WF_WORKFLOW_CONFIG_PARAM(
WORKFLOW_ID VARCHAR (45),
PARAM_NAME VARCHAR (45),
PARAM_VALUE VARCHAR (1000),
PARAM_QNAME VARCHAR (45),
PARAM_HOLDER VARCHAR (45),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (WORKFLOW_ID, PARAM_NAME, PARAM_QNAME, PARAM_HOLDER),
FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS WF_REQUEST_ENTITY_RELATIONSHIP(
REQUEST_ID VARCHAR (45),
ENTITY_NAME VARCHAR (255),
ENTITY_TYPE VARCHAR (50),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY(REQUEST_ID, ENTITY_NAME, ENTITY_TYPE, TENANT_ID),
FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS WF_WORKFLOW_REQUEST_RELATION(
RELATIONSHIP_ID VARCHAR (45),
WORKFLOW_ID VARCHAR (45),
REQUEST_ID VARCHAR (45),
UPDATED_AT TIMESTAMP,
STATUS VARCHAR (30),
TENANT_ID INTEGER DEFAULT -1,
PRIMARY KEY (RELATIONSHIP_ID),
FOREIGN KEY (WORKFLOW_ID) REFERENCES WF_WORKFLOW(ID)ON DELETE CASCADE,
FOREIGN KEY (REQUEST_ID) REFERENCES WF_REQUEST(UUID)ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_RECOVERY_DATA (
USER_NAME VARCHAR(255) NOT NULL,
USER_DOMAIN VARCHAR(127) NOT NULL,
TENANT_ID INTEGER DEFAULT -1,
CODE VARCHAR(255) NOT NULL,
SCENARIO VARCHAR(255) NOT NULL,
STEP VARCHAR(127) NOT NULL,
TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
REMAINING_SETS VARCHAR(2500) DEFAULT NULL,
PRIMARY KEY(USER_NAME, USER_DOMAIN, TENANT_ID, SCENARIO,STEP),
UNIQUE(CODE)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_PASSWORD_HISTORY_DATA (
ID INTEGER NOT NULL AUTO_INCREMENT,
USER_NAME VARCHAR(127) NOT NULL,
USER_DOMAIN VARCHAR(50) NOT NULL,
TENANT_ID INTEGER DEFAULT -1,
SALT_VALUE VARCHAR(255),
HASH VARCHAR(255) NOT NULL,
TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(ID),
UNIQUE (USER_NAME,USER_DOMAIN,TENANT_ID,SALT_VALUE,HASH)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_CLAIM_DIALECT (
ID INTEGER NOT NULL AUTO_INCREMENT,
DIALECT_URI VARCHAR (255) NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT DIALECT_URI_CONSTRAINT UNIQUE (DIALECT_URI, TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_CLAIM (
ID INTEGER NOT NULL AUTO_INCREMENT,
DIALECT_ID INTEGER NOT NULL,
CLAIM_URI VARCHAR (255) NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (DIALECT_ID) REFERENCES IDN_CLAIM_DIALECT(ID) ON DELETE CASCADE,
CONSTRAINT CLAIM_URI_CONSTRAINT UNIQUE (DIALECT_ID, CLAIM_URI, TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_CLAIM_MAPPED_ATTRIBUTE (
ID INTEGER NOT NULL AUTO_INCREMENT,
LOCAL_CLAIM_ID INTEGER,
USER_STORE_DOMAIN_NAME VARCHAR (255) NOT NULL,
ATTRIBUTE_NAME VARCHAR (255) NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (LOCAL_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE,
CONSTRAINT USER_STORE_DOMAIN_CONSTRAINT UNIQUE (LOCAL_CLAIM_ID, USER_STORE_DOMAIN_NAME, TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_CLAIM_PROPERTY (
ID INTEGER NOT NULL AUTO_INCREMENT,
LOCAL_CLAIM_ID INTEGER,
PROPERTY_NAME VARCHAR (255) NOT NULL,
PROPERTY_VALUE VARCHAR (255) NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (LOCAL_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE,
CONSTRAINT PROPERTY_NAME_CONSTRAINT UNIQUE (LOCAL_CLAIM_ID, PROPERTY_NAME, TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_CLAIM_MAPPING (
ID INTEGER NOT NULL AUTO_INCREMENT,
EXT_CLAIM_ID INTEGER NOT NULL,
MAPPED_LOCAL_CLAIM_ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (EXT_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE,
FOREIGN KEY (MAPPED_LOCAL_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE,
CONSTRAINT EXT_TO_LOC_MAPPING_CONSTRN UNIQUE (EXT_CLAIM_ID, TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_SAML2_ASSERTION_STORE (
ID INTEGER NOT NULL AUTO_INCREMENT,
SAML2_ID VARCHAR(255) ,
SAML2_ISSUER VARCHAR(255) ,
SAML2_SUBJECT VARCHAR(255) ,
SAML2_SESSION_INDEX VARCHAR(255) ,
SAML2_AUTHN_CONTEXT_CLASS_REF VARCHAR(255) ,
SAML2_ASSERTION VARCHAR(4096) ,
ASSERTION BLOB ,
PRIMARY KEY (ID)
)ENGINE INNODB;
CREATE TABLE IDN_SAML2_ARTIFACT_STORE (
ID INT(11) NOT NULL AUTO_INCREMENT,
SOURCE_ID VARCHAR(255) NOT NULL,
MESSAGE_HANDLER VARCHAR(255) NOT NULL,
AUTHN_REQ_DTO BLOB NOT NULL,
SESSION_ID VARCHAR(255) NOT NULL,
EXP_TIMESTAMP TIMESTAMP NOT NULL,
INIT_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
ASSERTION_ID VARCHAR(255),
PRIMARY KEY (`ID`)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OIDC_JTI (
JWT_ID VARCHAR(255) NOT NULL,
EXP_TIME TIMESTAMP NOT NULL ,
TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY (JWT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OIDC_PROPERTY (
ID INTEGER NOT NULL AUTO_INCREMENT,
TENANT_ID INTEGER,
CONSUMER_KEY VARCHAR(255) ,
PROPERTY_KEY VARCHAR(255) NOT NULL,
PROPERTY_VALUE VARCHAR(2047) ,
PRIMARY KEY (ID),
FOREIGN KEY (CONSUMER_KEY) REFERENCES IDN_OAUTH_CONSUMER_APPS(CONSUMER_KEY) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OIDC_REQ_OBJECT_REFERENCE (
ID INTEGER NOT NULL AUTO_INCREMENT,
CONSUMER_KEY_ID INTEGER ,
CODE_ID VARCHAR(255) ,
TOKEN_ID VARCHAR(255) ,
SESSION_DATA_KEY VARCHAR(255),
PRIMARY KEY (ID),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE,
FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE,
FOREIGN KEY (CODE_ID) REFERENCES IDN_OAUTH2_AUTHORIZATION_CODE(CODE_ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OIDC_REQ_OBJECT_CLAIMS (
ID INTEGER NOT NULL AUTO_INCREMENT,
REQ_OBJECT_ID INTEGER,
CLAIM_ATTRIBUTE VARCHAR(255) ,
ESSENTIAL CHAR(1) NOT NULL DEFAULT '0' ,
VALUE VARCHAR(255) ,
IS_USERINFO CHAR(1) NOT NULL DEFAULT '0',
PRIMARY KEY (ID),
FOREIGN KEY (REQ_OBJECT_ID) REFERENCES IDN_OIDC_REQ_OBJECT_REFERENCE (ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OIDC_REQ_OBJ_CLAIM_VALUES (
ID INTEGER NOT NULL AUTO_INCREMENT,
REQ_OBJECT_CLAIMS_ID INTEGER ,
CLAIM_VALUES VARCHAR(255) ,
PRIMARY KEY (ID),
FOREIGN KEY (REQ_OBJECT_CLAIMS_ID) REFERENCES IDN_OIDC_REQ_OBJECT_CLAIMS(ID) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_CERTIFICATE (
ID INTEGER NOT NULL AUTO_INCREMENT,
NAME VARCHAR(100),
CERTIFICATE_IN_PEM BLOB,
TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY(ID),
CONSTRAINT CERTIFICATE_UNIQUE_KEY UNIQUE (NAME, TENANT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OIDC_SCOPE_CLAIM_MAPPING (
ID INTEGER NOT NULL AUTO_INCREMENT,
SCOPE_ID INTEGER NOT NULL,
EXTERNAL_CLAIM_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE(SCOPE_ID) ON DELETE CASCADE,
FOREIGN KEY (EXTERNAL_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE,
UNIQUE (SCOPE_ID, EXTERNAL_CLAIM_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_FUNCTION_LIBRARY (
NAME VARCHAR(255) NOT NULL,
DESCRIPTION VARCHAR(1023),
TYPE VARCHAR(255) NOT NULL,
TENANT_ID INTEGER NOT NULL,
DATA BLOB NOT NULL,
PRIMARY KEY (TENANT_ID,NAME)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_CIBA_AUTH_CODE (
AUTH_CODE_KEY CHAR (36),
AUTH_REQ_ID CHAR (36),
ISSUED_TIME TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSUMER_KEY VARCHAR(255),
LAST_POLLED_TIME TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
POLLING_INTERVAL INTEGER,
EXPIRES_IN INTEGER,
AUTHENTICATED_USER_NAME VARCHAR(255),
USER_STORE_DOMAIN VARCHAR(100),
TENANT_ID INTEGER,
AUTH_REQ_STATUS VARCHAR (100) DEFAULT 'REQUESTED',
IDP_ID INTEGER,
UNIQUE(AUTH_REQ_ID),
PRIMARY KEY (AUTH_CODE_KEY),
FOREIGN KEY (CONSUMER_KEY) REFERENCES IDN_OAUTH_CONSUMER_APPS(CONSUMER_KEY) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_CIBA_REQUEST_SCOPES (
AUTH_CODE_KEY CHAR (36),
SCOPE VARCHAR (255),
FOREIGN KEY (AUTH_CODE_KEY) REFERENCES IDN_OAUTH2_CIBA_AUTH_CODE(AUTH_CODE_KEY) ON DELETE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS IDN_FED_AUTH_SESSION_MAPPING (
IDP_SESSION_ID VARCHAR(255) NOT NULL,
SESSION_ID VARCHAR(255) NOT NULL,
IDP_NAME VARCHAR(255) NOT NULL,
AUTHENTICATOR_ID VARCHAR(255),
PROTOCOL_TYPE VARCHAR(255),
TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (IDP_SESSION_ID)
)ENGINE INNODB;
-- --------------------------- INDEX CREATION -----------------------------
-- IDN_OAUTH2_ACCESS_TOKEN --
CREATE INDEX IDX_TC ON IDN_OAUTH2_ACCESS_TOKEN(TIME_CREATED);
CREATE INDEX IDX_ATH ON IDN_OAUTH2_ACCESS_TOKEN(ACCESS_TOKEN_HASH);
CREATE INDEX IDX_AT_CK_AU ON IDN_OAUTH2_ACCESS_TOKEN(CONSUMER_KEY_ID, AUTHZ_USER, TOKEN_STATE, USER_TYPE);
CREATE INDEX IDX_AT_TI_UD ON IDN_OAUTH2_ACCESS_TOKEN(AUTHZ_USER, TENANT_ID, TOKEN_STATE, USER_DOMAIN);
CREATE INDEX IDX_AT_AU_TID_UD_TS_CKID ON IDN_OAUTH2_ACCESS_TOKEN(AUTHZ_USER, TENANT_ID, USER_DOMAIN, TOKEN_STATE, CONSUMER_KEY_ID);
CREATE INDEX IDX_AT_AU_CKID_TS_UT ON IDN_OAUTH2_ACCESS_TOKEN(AUTHZ_USER, CONSUMER_KEY_ID, TOKEN_STATE, USER_TYPE);
CREATE INDEX IDX_AT_RTH ON IDN_OAUTH2_ACCESS_TOKEN(REFRESH_TOKEN_HASH);
CREATE INDEX IDX_AT_CKID_AU_TID_UD_TSH_TS ON IDN_OAUTH2_ACCESS_TOKEN(CONSUMER_KEY_ID, AUTHZ_USER, TENANT_ID, USER_DOMAIN, TOKEN_SCOPE_HASH, TOKEN_STATE);
-- IDN_OAUTH2_AUTHORIZATION_CODE --
CREATE INDEX IDX_AUTHORIZATION_CODE_HASH ON IDN_OAUTH2_AUTHORIZATION_CODE (AUTHORIZATION_CODE_HASH, CONSUMER_KEY_ID);
CREATE INDEX IDX_AUTHORIZATION_CODE_AU_TI ON IDN_OAUTH2_AUTHORIZATION_CODE (AUTHZ_USER, TENANT_ID, USER_DOMAIN, STATE);
CREATE INDEX IDX_AC_CKID ON IDN_OAUTH2_AUTHORIZATION_CODE(CONSUMER_KEY_ID);
CREATE INDEX IDX_AC_TID ON IDN_OAUTH2_AUTHORIZATION_CODE(TOKEN_ID);
-- IDN_SCIM_GROUP --
CREATE INDEX IDX_IDN_SCIM_GROUP_TI_RN ON IDN_SCIM_GROUP (TENANT_ID, ROLE_NAME);
CREATE INDEX IDX_IDN_SCIM_GROUP_TI_RN_AN ON IDN_SCIM_GROUP (TENANT_ID, ROLE_NAME, ATTR_NAME(500));
-- IDN_AUTH_SESSION_STORE --
CREATE INDEX IDX_IDN_AUTH_SESSION_TIME ON IDN_AUTH_SESSION_STORE (TIME_CREATED);
-- IDN_AUTH_TEMP_SESSION_STORE --
CREATE INDEX IDX_IDN_AUTH_TMP_SESSION_TIME ON IDN_AUTH_TEMP_SESSION_STORE (TIME_CREATED);
-- IDN_OIDC_SCOPE_CLAIM_MAPPING --
CREATE INDEX IDX_AT_SI_ECI ON IDN_OIDC_SCOPE_CLAIM_MAPPING(SCOPE_ID, EXTERNAL_CLAIM_ID);
-- IDN_OAUTH2_SCOPE --
CREATE INDEX IDX_SC_TID ON IDN_OAUTH2_SCOPE(TENANT_ID);
-- IDN_OAUTH2_SCOPE_BINDING --
CREATE INDEX IDX_SB_SCPID ON IDN_OAUTH2_SCOPE_BINDING(SCOPE_ID);
-- IDN_OIDC_REQ_OBJECT_REFERENCE --
CREATE INDEX IDX_OROR_TID ON IDN_OIDC_REQ_OBJECT_REFERENCE(TOKEN_ID);
-- IDN_OAUTH2_ACCESS_TOKEN_SCOPE --
CREATE INDEX IDX_ATS_TID ON IDN_OAUTH2_ACCESS_TOKEN_SCOPE(TOKEN_ID);
-- SP_TEMPLATE --
CREATE INDEX IDX_SP_TEMPLATE ON SP_TEMPLATE (TENANT_ID, NAME);
-- IDN_AUTH_USER --
CREATE INDEX IDX_AUTH_USER_UN_TID_DN ON IDN_AUTH_USER (USER_NAME, TENANT_ID, DOMAIN_NAME);
CREATE INDEX IDX_AUTH_USER_DN_TOD ON IDN_AUTH_USER (DOMAIN_NAME, TENANT_ID);
-- IDN_AUTH_USER_SESSION_MAPPING --
CREATE INDEX IDX_USER_ID ON IDN_AUTH_USER_SESSION_MAPPING (USER_ID);
CREATE INDEX IDX_SESSION_ID ON IDN_AUTH_USER_SESSION_MAPPING (SESSION_ID);
-- IDN_OAUTH_CONSUMER_APPS --
CREATE INDEX IDX_OCA_UM_TID_UD_APN ON IDN_OAUTH_CONSUMER_APPS(USERNAME,TENANT_ID,USER_DOMAIN, APP_NAME);
-- IDX_SPI_APP --
CREATE INDEX IDX_SPI_APP ON SP_INBOUND_AUTH(APP_ID);
-- IDN_OIDC_PROPERTY --
CREATE INDEX IDX_IOP_TID_CK ON IDN_OIDC_PROPERTY(TENANT_ID,CONSUMER_KEY);
-- IDN_FIDO2_PROPERTY --
CREATE INDEX IDX_FIDO2_STR ON FIDO2_DEVICE_STORE(USER_NAME, TENANT_ID, DOMAIN_NAME, CREDENTIAL_ID, USER_HANDLE);
-- IDN_ASSOCIATED_ID --
CREATE INDEX IDX_AI_DN_UN_AI ON IDN_ASSOCIATED_ID(DOMAIN_NAME, USER_NAME, ASSOCIATION_ID);
-- IDN_OAUTH2_TOKEN_BINDING --
CREATE INDEX IDX_IDN_AUTH_BIND ON IDN_OAUTH2_TOKEN_BINDING (TOKEN_BINDING_REF);
-- IDN_FED_AUTH_SESSION_MAPPING --
CREATE INDEX IDX_FEDERATED_AUTH_SESSION_ID ON IDN_FED_AUTH_SESSION_MAPPING (SESSION_ID);
-- End of IDENTITY Tables--
-- Start of CONSENT-MGT Tables --
CREATE TABLE CM_PII_CATEGORY (
ID INTEGER AUTO_INCREMENT,
NAME VARCHAR(255) NOT NULL,
DESCRIPTION VARCHAR(1023),
DISPLAY_NAME VARCHAR(255),
IS_SENSITIVE INTEGER NOT NULL,
TENANT_ID INTEGER DEFAULT '-1234',
UNIQUE KEY (NAME, TENANT_ID),
PRIMARY KEY (ID)
);
CREATE TABLE CM_RECEIPT (
CONSENT_RECEIPT_ID VARCHAR(255) NOT NULL,
VERSION VARCHAR(255) NOT NULL,
JURISDICTION VARCHAR(255) NOT NULL,
CONSENT_TIMESTAMP TIMESTAMP NOT NULL,
COLLECTION_METHOD VARCHAR(255) NOT NULL,
LANGUAGE VARCHAR(255) NOT NULL,
PII_PRINCIPAL_ID VARCHAR(255) NOT NULL,
PRINCIPAL_TENANT_ID INTEGER DEFAULT '-1234',
POLICY_URL VARCHAR(255) NOT NULL,
STATE VARCHAR(255) NOT NULL,
PII_CONTROLLER VARCHAR(2048) NOT NULL,
PRIMARY KEY (CONSENT_RECEIPT_ID)
);
CREATE TABLE CM_PURPOSE (
ID INTEGER AUTO_INCREMENT,
NAME VARCHAR(255) NOT NULL,
DESCRIPTION VARCHAR(1023),
PURPOSE_GROUP VARCHAR(255) NOT NULL,
GROUP_TYPE VARCHAR(255) NOT NULL,
TENANT_ID INTEGER DEFAULT '-1234',
UNIQUE KEY (NAME, TENANT_ID, PURPOSE_GROUP, GROUP_TYPE),
PRIMARY KEY (ID)
);
CREATE TABLE CM_PURPOSE_CATEGORY (
ID INTEGER AUTO_INCREMENT,
NAME VARCHAR(255) NOT NULL,
DESCRIPTION VARCHAR(1023),
TENANT_ID INTEGER DEFAULT '-1234',
UNIQUE KEY (NAME, TENANT_ID),
PRIMARY KEY (ID)
);
CREATE TABLE CM_RECEIPT_SP_ASSOC (
ID INTEGER AUTO_INCREMENT,
CONSENT_RECEIPT_ID VARCHAR(255) NOT NULL,
SP_NAME VARCHAR(255) NOT NULL,
SP_DISPLAY_NAME VARCHAR(255),
SP_DESCRIPTION VARCHAR(255),
SP_TENANT_ID INTEGER DEFAULT '-1234',
UNIQUE KEY (CONSENT_RECEIPT_ID, SP_NAME, SP_TENANT_ID),
PRIMARY KEY (ID)
);
CREATE TABLE CM_SP_PURPOSE_ASSOC (
ID INTEGER AUTO_INCREMENT,
RECEIPT_SP_ASSOC INTEGER NOT NULL,
PURPOSE_ID INTEGER NOT NULL,
CONSENT_TYPE VARCHAR(255) NOT NULL,
IS_PRIMARY_PURPOSE INTEGER NOT NULL,
TERMINATION VARCHAR(255) NOT NULL,
THIRD_PARTY_DISCLOSURE INTEGER NOT NULL,
THIRD_PARTY_NAME VARCHAR(255),
UNIQUE KEY (RECEIPT_SP_ASSOC, PURPOSE_ID),
PRIMARY KEY (ID)
);
CREATE TABLE CM_SP_PURPOSE_PURPOSE_CAT_ASSC (
SP_PURPOSE_ASSOC_ID INTEGER NOT NULL,
PURPOSE_CATEGORY_ID INTEGER NOT NULL,
UNIQUE KEY (SP_PURPOSE_ASSOC_ID, PURPOSE_CATEGORY_ID)
);
CREATE TABLE CM_PURPOSE_PII_CAT_ASSOC (
PURPOSE_ID INTEGER NOT NULL,
CM_PII_CATEGORY_ID INTEGER NOT NULL,
IS_MANDATORY INTEGER NOT NULL,
UNIQUE KEY (PURPOSE_ID, CM_PII_CATEGORY_ID)
);
CREATE TABLE CM_SP_PURPOSE_PII_CAT_ASSOC (
SP_PURPOSE_ASSOC_ID INTEGER NOT NULL,
PII_CATEGORY_ID INTEGER NOT NULL,
VALIDITY VARCHAR(1023),
UNIQUE KEY (SP_PURPOSE_ASSOC_ID, PII_CATEGORY_ID)
);
CREATE TABLE CM_CONSENT_RECEIPT_PROPERTY (
CONSENT_RECEIPT_ID VARCHAR(255) NOT NULL,
NAME VARCHAR(255) NOT NULL,
VALUE VARCHAR(1023) NOT NULL,
UNIQUE KEY (CONSENT_RECEIPT_ID, NAME)
);
ALTER TABLE CM_RECEIPT_SP_ASSOC
ADD CONSTRAINT CM_RECEIPT_SP_ASSOC_fk0 FOREIGN KEY (CONSENT_RECEIPT_ID) REFERENCES CM_RECEIPT (CONSENT_RECEIPT_ID);
ALTER TABLE CM_SP_PURPOSE_ASSOC
ADD CONSTRAINT CM_SP_PURPOSE_ASSOC_fk0 FOREIGN KEY (RECEIPT_SP_ASSOC) REFERENCES CM_RECEIPT_SP_ASSOC (ID);
ALTER TABLE CM_SP_PURPOSE_ASSOC
ADD CONSTRAINT CM_SP_PURPOSE_ASSOC_fk1 FOREIGN KEY (PURPOSE_ID) REFERENCES CM_PURPOSE (ID);
ALTER TABLE CM_SP_PURPOSE_PURPOSE_CAT_ASSC
ADD CONSTRAINT CM_SP_P_P_CAT_ASSOC_fk0 FOREIGN KEY (SP_PURPOSE_ASSOC_ID) REFERENCES CM_SP_PURPOSE_ASSOC (ID);
ALTER TABLE CM_SP_PURPOSE_PURPOSE_CAT_ASSC
ADD CONSTRAINT CM_SP_P_P_CAT_ASSOC_fk1 FOREIGN KEY (PURPOSE_CATEGORY_ID) REFERENCES CM_PURPOSE_CATEGORY (ID);
ALTER TABLE CM_SP_PURPOSE_PII_CAT_ASSOC
ADD CONSTRAINT CM_SP_P_PII_CAT_ASSOC_fk0 FOREIGN KEY (SP_PURPOSE_ASSOC_ID) REFERENCES CM_SP_PURPOSE_ASSOC (ID);
ALTER TABLE CM_SP_PURPOSE_PII_CAT_ASSOC
ADD CONSTRAINT CM_SP_P_PII_CAT_ASSOC_fk1 FOREIGN KEY (PII_CATEGORY_ID) REFERENCES CM_PII_CATEGORY (ID);
ALTER TABLE CM_CONSENT_RECEIPT_PROPERTY
ADD CONSTRAINT CM_CONSENT_RECEIPT_PRT_fk0 FOREIGN KEY (CONSENT_RECEIPT_ID) REFERENCES CM_RECEIPT (CONSENT_RECEIPT_ID);
INSERT INTO CM_PURPOSE (NAME, DESCRIPTION, PURPOSE_GROUP, GROUP_TYPE, TENANT_ID) VALUES ('DEFAULT', 'For core functionalities of the product', 'DEFAULT', 'SP', '-1234');
INSERT INTO CM_PURPOSE_CATEGORY (NAME, DESCRIPTION, TENANT_ID) VALUES ('DEFAULT','For core functionalities of the product', '-1234');
-- End of CONSENT-MGT Tables --
-- Start of API-MGT Tables --
CREATE TABLE IF NOT EXISTS AM_SUBSCRIBER (
SUBSCRIBER_ID INTEGER AUTO_INCREMENT,
USER_ID VARCHAR(255) NOT NULL,
TENANT_ID INTEGER NOT NULL,
EMAIL_ADDRESS VARCHAR(256) NULL,
DATE_SUBSCRIBED TIMESTAMP NOT NULL,
PRIMARY KEY (SUBSCRIBER_ID),
CREATED_BY VARCHAR(100),
CREATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UPDATED_BY VARCHAR(100),
UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE (TENANT_ID,USER_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_APPLICATION (
APPLICATION_ID INTEGER AUTO_INCREMENT,
NAME VARCHAR(100),
SUBSCRIBER_ID INTEGER,
APPLICATION_TIER VARCHAR(50) DEFAULT 'Unlimited',
CALLBACK_URL VARCHAR(512),
DESCRIPTION VARCHAR(512),
APPLICATION_STATUS VARCHAR(50) DEFAULT 'APPROVED',
GROUP_ID VARCHAR(100),
CREATED_BY VARCHAR(100),
CREATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(100),
UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UUID VARCHAR(256),
TOKEN_TYPE VARCHAR(10),
FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY(APPLICATION_ID),
UNIQUE (NAME,SUBSCRIBER_ID),
UNIQUE (UUID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_API (
API_ID INTEGER AUTO_INCREMENT,
API_PROVIDER VARCHAR(200),
API_NAME VARCHAR(200),
API_VERSION VARCHAR(30),
CONTEXT VARCHAR(256),
CONTEXT_TEMPLATE VARCHAR(256),
API_TIER VARCHAR(256),
API_TYPE VARCHAR(10),
CREATED_BY VARCHAR(100),
CREATED_TIME TIMESTAMP,
UPDATED_BY VARCHAR(100),
UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(API_ID),
UNIQUE (API_PROVIDER,API_NAME,API_VERSION)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_GRAPHQL_COMPLEXITY (
UUID VARCHAR(256),
API_ID INTEGER NOT NULL,
TYPE VARCHAR(256),
FIELD VARCHAR(256),
COMPLEXITY_VALUE INTEGER,
FOREIGN KEY (API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE CASCADE,
PRIMARY KEY(UUID),
UNIQUE (API_ID,TYPE,FIELD)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_API_URL_MAPPING (
URL_MAPPING_ID INTEGER AUTO_INCREMENT,
API_ID INTEGER NOT NULL,
HTTP_METHOD VARCHAR(20) NULL,
AUTH_SCHEME VARCHAR(50) NULL,
URL_PATTERN VARCHAR(512) NULL,
THROTTLING_TIER varchar(512) DEFAULT NULL,
MEDIATION_SCRIPT BLOB,
PRIMARY KEY (URL_MAPPING_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_API_RESOURCE_SCOPE_MAPPING (
SCOPE_NAME VARCHAR(255) NOT NULL,
URL_MAPPING_ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL,
FOREIGN KEY (URL_MAPPING_ID) REFERENCES AM_API_URL_MAPPING(URL_MAPPING_ID) ON DELETE CASCADE,
PRIMARY KEY(SCOPE_NAME, URL_MAPPING_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_SECURITY_AUDIT_UUID_MAPPING (
API_ID INTEGER NOT NULL,
AUDIT_UUID VARCHAR(255) NOT NULL,
FOREIGN KEY (API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY (API_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_API_PRODUCT_MAPPING (
API_PRODUCT_MAPPING_ID INTEGER AUTO_INCREMENT,
API_ID INTEGER,
URL_MAPPING_ID INTEGER,
FOREIGN KEY (API_ID) REFERENCES AM_API(API_ID) ON DELETE CASCADE,
FOREIGN KEY (URL_MAPPING_ID) REFERENCES AM_API_URL_MAPPING(URL_MAPPING_ID) ON DELETE CASCADE,
PRIMARY KEY(API_PRODUCT_MAPPING_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION (
SUBSCRIPTION_ID INTEGER AUTO_INCREMENT,
TIER_ID VARCHAR(50),
TIER_ID_PENDING VARCHAR(50),
API_ID INTEGER,
LAST_ACCESSED TIMESTAMP NULL,
APPLICATION_ID INTEGER,
SUB_STATUS VARCHAR(50),
SUBS_CREATE_STATE VARCHAR(50) DEFAULT 'SUBSCRIBE',
CREATED_BY VARCHAR(100),
CREATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UPDATED_BY VARCHAR(100),
UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UUID VARCHAR(256),
FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY (SUBSCRIPTION_ID),
UNIQUE (UUID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_SUBSCRIPTION_KEY_MAPPING (
SUBSCRIPTION_ID INTEGER,
ACCESS_TOKEN VARCHAR(512),
KEY_TYPE VARCHAR(512) NOT NULL,
FOREIGN KEY(SUBSCRIPTION_ID) REFERENCES AM_SUBSCRIPTION(SUBSCRIPTION_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY(SUBSCRIPTION_ID,ACCESS_TOKEN)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_APPLICATION_KEY_MAPPING (
UUID VARCHAR(100),
APPLICATION_ID INTEGER,
CONSUMER_KEY VARCHAR(255),
KEY_TYPE VARCHAR(512) NOT NULL,
STATE VARCHAR(30) NOT NULL,
CREATE_MODE VARCHAR(30) DEFAULT 'CREATED',
KEY_MANAGER VARCHAR(100),
APP_INFO BLOB ,
FOREIGN KEY(APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY(APPLICATION_ID,KEY_TYPE,KEY_MANAGER)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_API_LC_EVENT (
EVENT_ID INTEGER AUTO_INCREMENT,
API_ID INTEGER NOT NULL,
PREVIOUS_STATE VARCHAR(50),
NEW_STATE VARCHAR(50) NOT NULL,
USER_ID VARCHAR(255) NOT NULL,
TENANT_ID INTEGER NOT NULL,
EVENT_DATE TIMESTAMP NOT NULL,
FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY (EVENT_ID)
)ENGINE INNODB;
CREATE TABLE AM_APP_KEY_DOMAIN_MAPPING (
CONSUMER_KEY VARCHAR(255),
AUTHZ_DOMAIN VARCHAR(255) DEFAULT 'ALL',
PRIMARY KEY (CONSUMER_KEY,AUTHZ_DOMAIN)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_API_COMMENTS (
COMMENT_ID VARCHAR(255) NOT NULL,
COMMENT_TEXT VARCHAR(512),
COMMENTED_USER VARCHAR(255),
DATE_COMMENTED TIMESTAMP NOT NULL,
API_ID INTEGER,
FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY (COMMENT_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_API_RATINGS (
RATING_ID VARCHAR(255) NOT NULL,
API_ID INTEGER,
RATING INTEGER,
SUBSCRIBER_ID INTEGER,
FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY (RATING_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_TIER_PERMISSIONS (
TIER_PERMISSIONS_ID INTEGER AUTO_INCREMENT,
TIER VARCHAR(50) NOT NULL,
PERMISSIONS_TYPE VARCHAR(50) NOT NULL,
ROLES VARCHAR(512) NOT NULL,
TENANT_ID INTEGER NOT NULL,
PRIMARY KEY(TIER_PERMISSIONS_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_EXTERNAL_STORES (
APISTORE_ID INTEGER AUTO_INCREMENT,
API_ID INTEGER,
STORE_ID VARCHAR(255) NOT NULL,
STORE_DISPLAY_NAME VARCHAR(255) NOT NULL,
STORE_ENDPOINT VARCHAR(255) NOT NULL,
STORE_TYPE VARCHAR(255) NOT NULL,
LAST_UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY(API_ID) REFERENCES AM_API(API_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY (APISTORE_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_WORKFLOWS(
WF_ID INTEGER AUTO_INCREMENT,
WF_REFERENCE VARCHAR(255) NOT NULL,
WF_TYPE VARCHAR(255) NOT NULL,
WF_STATUS VARCHAR(255) NOT NULL,
WF_CREATED_TIME TIMESTAMP,
WF_UPDATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
WF_STATUS_DESC VARCHAR(1000),
TENANT_ID INTEGER,
TENANT_DOMAIN VARCHAR(255),
WF_EXTERNAL_REFERENCE VARCHAR(255) NOT NULL,
WF_METADATA BLOB DEFAULT NULL,
WF_PROPERTIES BLOB DEFAULT NULL,
PRIMARY KEY (WF_ID),
UNIQUE (WF_EXTERNAL_REFERENCE)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_APPLICATION_REGISTRATION (
REG_ID INT AUTO_INCREMENT,
SUBSCRIBER_ID INT,
WF_REF VARCHAR(255) NOT NULL,
APP_ID INT,
TOKEN_TYPE VARCHAR(30),
TOKEN_SCOPE VARCHAR(1500) DEFAULT 'default',
INPUTS VARCHAR(1000),
ALLOWED_DOMAINS VARCHAR(256),
VALIDITY_PERIOD BIGINT,
KEY_MANAGER VARCHAR(255) NOT NULL,
UNIQUE (SUBSCRIBER_ID,APP_ID,TOKEN_TYPE,KEY_MANAGER),
FOREIGN KEY(SUBSCRIBER_ID) REFERENCES AM_SUBSCRIBER(SUBSCRIBER_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
FOREIGN KEY(APP_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON UPDATE CASCADE ON DELETE RESTRICT,
PRIMARY KEY (REG_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_SHARED_SCOPE (
NAME VARCHAR(255) NOT NULL,
UUID VARCHAR (256),
TENANT_ID INTEGER,
PRIMARY KEY (UUID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_API_DEFAULT_VERSION (
DEFAULT_VERSION_ID INT AUTO_INCREMENT,
API_NAME VARCHAR(256) NOT NULL ,
API_PROVIDER VARCHAR(256) NOT NULL ,
DEFAULT_API_VERSION VARCHAR(30) ,
PUBLISHED_DEFAULT_API_VERSION VARCHAR(30) ,
PRIMARY KEY (DEFAULT_VERSION_ID)
)ENGINE = INNODB;
CREATE INDEX IDX_SUB_APP_ID ON AM_SUBSCRIPTION (APPLICATION_ID, SUBSCRIPTION_ID);
CREATE TABLE IF NOT EXISTS AM_MONETIZATION_USAGE (
ID VARCHAR(100) NOT NULL,
STATE VARCHAR(50) NOT NULL,
STATUS VARCHAR(50) NOT NULL,
STARTED_TIME VARCHAR(50) NOT NULL,
PUBLISHED_TIME VARCHAR(50) NOT NULL,
PRIMARY KEY(ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_ALERT_TYPES (
ALERT_TYPE_ID INTEGER AUTO_INCREMENT,
ALERT_TYPE_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL,
PRIMARY KEY (ALERT_TYPE_ID)
)ENGINE = INNODB;
CREATE TABLE IF NOT EXISTS AM_ALERT_TYPES_VALUES (
ALERT_TYPE_ID INTEGER,
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
PRIMARY KEY (ALERT_TYPE_ID,USER_NAME,STAKE_HOLDER)
)ENGINE = INNODB;
CREATE TABLE IF NOT EXISTS AM_ALERT_EMAILLIST (
EMAIL_LIST_ID INTEGER AUTO_INCREMENT,
USER_NAME VARCHAR(255) NOT NULL ,
STAKE_HOLDER VARCHAR(100) NOT NULL ,
PRIMARY KEY (EMAIL_LIST_ID,USER_NAME,STAKE_HOLDER)
)ENGINE = INNODB;
CREATE TABLE IF NOT EXISTS AM_ALERT_EMAILLIST_DETAILS (
EMAIL_LIST_ID INTEGER,
EMAIL VARCHAR(255),
PRIMARY KEY (EMAIL_LIST_ID,EMAIL)
)ENGINE = INNODB;
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalResponseTime', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalBackendTime', 'publisher');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalRequestsPerMin', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('AbnormalRequestPattern', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('UnusualIPAccess', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('FrequentTierLimitHitting', 'subscriber');
INSERT INTO AM_ALERT_TYPES (ALERT_TYPE_NAME, STAKE_HOLDER) VALUES ('ApiHealthMonitor', 'publisher');
-- AM Throttling tables --
CREATE TABLE IF NOT EXISTS AM_POLICY_SUBSCRIPTION (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INT(11) NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL,
UNIT_TIME INT(11) NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
RATE_LIMIT_COUNT INT(11) NULL DEFAULT NULL,
RATE_LIMIT_TIME_UNIT VARCHAR(25) NULL DEFAULT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,
STOP_ON_QUOTA_REACH BOOLEAN NOT NULL DEFAULT 0,
BILLING_PLAN VARCHAR(20) NOT NULL,
UUID VARCHAR(256),
MONETIZATION_PLAN VARCHAR(25) NULL DEFAULT NULL,
FIXED_RATE VARCHAR(15) NULL DEFAULT NULL,
BILLING_CYCLE VARCHAR(15) NULL DEFAULT NULL,
PRICE_PER_REQUEST VARCHAR(15) NULL DEFAULT NULL,
CURRENCY VARCHAR(15) NULL DEFAULT NULL,
MAX_COMPLEXITY INT(11) NOT NULL DEFAULT 0,
MAX_DEPTH INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (POLICY_ID),
UNIQUE INDEX AM_POLICY_SUBSCRIPTION_NAME_TENANT (NAME, TENANT_ID),
UNIQUE (UUID)
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS AM_POLICY_APPLICATION (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INT(11) NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INT(11) NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
CUSTOM_ATTRIBUTES BLOB DEFAULT NULL,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE INDEX APP_NAME_TENANT (NAME, TENANT_ID),
UNIQUE (UUID)
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS AM_POLICY_HARD_THROTTLING (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(512) NOT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
QUOTA_TYPE VARCHAR(25) NOT NULL,
QUOTA INT(11) NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INT(11) NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (POLICY_ID),
UNIQUE INDEX POLICY_HARD_NAME_TENANT (NAME, TENANT_ID)
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS AM_API_THROTTLE_POLICY (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(512) NOT NULL,
DISPLAY_NAME VARCHAR(512) NULL DEFAULT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR (1024),
DEFAULT_QUOTA_TYPE VARCHAR(25) NOT NULL,
DEFAULT_QUOTA INTEGER NOT NULL,
DEFAULT_QUOTA_UNIT VARCHAR(10) NULL,
DEFAULT_UNIT_TIME INTEGER NOT NULL,
DEFAULT_TIME_UNIT VARCHAR(25) NOT NULL,
APPLICABLE_LEVEL VARCHAR(25) NOT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE INDEX API_NAME_TENANT (NAME, TENANT_ID),
UNIQUE (UUID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_CONDITION_GROUP (
CONDITION_GROUP_ID INTEGER NOT NULL AUTO_INCREMENT,
POLICY_ID INTEGER NOT NULL,
QUOTA_TYPE VARCHAR(25),
QUOTA INTEGER NOT NULL,
QUOTA_UNIT VARCHAR(10) NULL DEFAULT NULL,
UNIT_TIME INTEGER NOT NULL,
TIME_UNIT VARCHAR(25) NOT NULL,
DESCRIPTION VARCHAR (1024) NULL DEFAULT NULL,
PRIMARY KEY (CONDITION_GROUP_ID),
FOREIGN KEY (POLICY_ID) REFERENCES AM_API_THROTTLE_POLICY(POLICY_ID) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_QUERY_PARAMETER_CONDITION (
QUERY_PARAMETER_ID INTEGER NOT NULL AUTO_INCREMENT,
CONDITION_GROUP_ID INTEGER NOT NULL,
PARAMETER_NAME VARCHAR(255) DEFAULT NULL,
PARAMETER_VALUE VARCHAR(255) DEFAULT NULL,
IS_PARAM_MAPPING BOOLEAN DEFAULT 1,
PRIMARY KEY (QUERY_PARAMETER_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_HEADER_FIELD_CONDITION (
HEADER_FIELD_ID INTEGER NOT NULL AUTO_INCREMENT,
CONDITION_GROUP_ID INTEGER NOT NULL,
HEADER_FIELD_NAME VARCHAR(255) DEFAULT NULL,
HEADER_FIELD_VALUE VARCHAR(255) DEFAULT NULL,
IS_HEADER_FIELD_MAPPING BOOLEAN DEFAULT 1,
PRIMARY KEY (HEADER_FIELD_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_JWT_CLAIM_CONDITION (
JWT_CLAIM_ID INTEGER NOT NULL AUTO_INCREMENT,
CONDITION_GROUP_ID INTEGER NOT NULL,
CLAIM_URI VARCHAR(512) DEFAULT NULL,
CLAIM_ATTRIB VARCHAR(1024) DEFAULT NULL,
IS_CLAIM_MAPPING BOOLEAN DEFAULT 1,
PRIMARY KEY (JWT_CLAIM_ID),
FOREIGN KEY (CONDITION_GROUP_ID) REFERENCES AM_CONDITION_GROUP(CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_IP_CONDITION (
AM_IP_CONDITION_ID INT NOT NULL AUTO_INCREMENT,
STARTING_IP VARCHAR(45) NULL,
ENDING_IP VARCHAR(45) NULL,
SPECIFIC_IP VARCHAR(45) NULL,
WITHIN_IP_RANGE BOOLEAN DEFAULT 1,
CONDITION_GROUP_ID INT NULL,
PRIMARY KEY (AM_IP_CONDITION_ID),
INDEX fk_AM_IP_CONDITION_1_idx (CONDITION_GROUP_ID ASC), CONSTRAINT fk_AM_IP_CONDITION_1 FOREIGN KEY (CONDITION_GROUP_ID)
REFERENCES AM_CONDITION_GROUP (CONDITION_GROUP_ID) ON DELETE CASCADE ON UPDATE CASCADE)
ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS AM_POLICY_GLOBAL (
POLICY_ID INT(11) NOT NULL AUTO_INCREMENT,
NAME VARCHAR(512) NOT NULL,
KEY_TEMPLATE VARCHAR(512) NOT NULL,
TENANT_ID INT(11) NOT NULL,
DESCRIPTION VARCHAR(1024) NULL DEFAULT NULL,
SIDDHI_QUERY BLOB DEFAULT NULL,
IS_DEPLOYED TINYINT(1) NOT NULL DEFAULT 0,
UUID VARCHAR(256),
PRIMARY KEY (POLICY_ID),
UNIQUE (UUID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_THROTTLE_TIER_PERMISSIONS (
THROTTLE_TIER_PERMISSIONS_ID INT NOT NULL AUTO_INCREMENT,
TIER VARCHAR(50) NULL,
PERMISSIONS_TYPE VARCHAR(50) NULL,
ROLES VARCHAR(512) NULL,
TENANT_ID INT(11) NULL,
PRIMARY KEY (THROTTLE_TIER_PERMISSIONS_ID))
ENGINE = InnoDB;
CREATE TABLE `AM_BLOCK_CONDITIONS` (
`CONDITION_ID` int(11) NOT NULL AUTO_INCREMENT,
`TYPE` varchar(45) DEFAULT NULL,
`VALUE` varchar(512) DEFAULT NULL,
`ENABLED` varchar(45) DEFAULT NULL,
`DOMAIN` varchar(45) DEFAULT NULL,
`UUID` VARCHAR(256),
PRIMARY KEY (`CONDITION_ID`),
UNIQUE (`UUID`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `AM_CERTIFICATE_METADATA` (
`TENANT_ID` INT(11) NOT NULL,
`ALIAS` VARCHAR(255) NOT NULL,
`END_POINT` VARCHAR(255) NOT NULL,
CONSTRAINT PK_ALIAS PRIMARY KEY (`ALIAS`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `AM_API_CLIENT_CERTIFICATE` (
`TENANT_ID` INT(11) NOT NULL,
`ALIAS` VARCHAR(45) NOT NULL,
`API_ID` INTEGER NOT NULL,
`CERTIFICATE` BLOB NOT NULL,
`REMOVED` BOOLEAN NOT NULL DEFAULT 0,
`TIER_NAME` VARCHAR (512),
FOREIGN KEY (API_ID) REFERENCES AM_API (API_ID) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (`ALIAS`, `TENANT_ID`, `REMOVED`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS AM_APPLICATION_GROUP_MAPPING (
APPLICATION_ID INTEGER NOT NULL,
GROUP_ID VARCHAR(512) NOT NULL,
TENANT VARCHAR(255),
PRIMARY KEY (APPLICATION_ID,GROUP_ID,TENANT),
FOREIGN KEY (APPLICATION_ID) REFERENCES AM_APPLICATION(APPLICATION_ID) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS AM_USAGE_UPLOADED_FILES (
TENANT_DOMAIN varchar(255) NOT NULL,
FILE_NAME varchar(255) NOT NULL,
FILE_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FILE_PROCESSED tinyint(1) DEFAULT FALSE,
FILE_CONTENT MEDIUMBLOB DEFAULT NULL,
PRIMARY KEY (TENANT_DOMAIN, FILE_NAME, FILE_TIMESTAMP)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS AM_API_LC_PUBLISH_EVENTS (
ID INTEGER(11) NOT NULL AUTO_INCREMENT,
TENANT_DOMAIN VARCHAR(500) NOT NULL,
API_ID VARCHAR(500) NOT NULL,
EVENT_TIME TIMESTAMP NOT NULL,
PRIMARY KEY (ID)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS AM_APPLICATION_ATTRIBUTES (
APPLICATION_ID int(11) NOT NULL,
NAME varchar(255) NOT NULL,
VALUE varchar(1024) NOT NULL,
TENANT_ID int(11) NOT NULL,
PRIMARY KEY (APPLICATION_ID,NAME),
FOREIGN KEY (APPLICATION_ID) REFERENCES AM_APPLICATION (APPLICATION_ID) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS AM_LABELS (
LABEL_ID VARCHAR(50),
NAME VARCHAR(255),
DESCRIPTION VARCHAR(1024),
TENANT_DOMAIN VARCHAR(255),
UNIQUE (NAME,TENANT_DOMAIN),
PRIMARY KEY (LABEL_ID)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS AM_LABEL_URLS (
LABEL_ID VARCHAR(50),
ACCESS_URL VARCHAR(255),
PRIMARY KEY (LABEL_ID,ACCESS_URL),
FOREIGN KEY (LABEL_ID) REFERENCES AM_LABELS(LABEL_ID) ON UPDATE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS AM_SYSTEM_APPS (
ID INTEGER AUTO_INCREMENT,
NAME VARCHAR(50) NOT NULL,
CONSUMER_KEY VARCHAR(512) NOT NULL,
CONSUMER_SECRET VARCHAR(512) NOT NULL,
CREATED_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
TENANT_DOMAIN VARCHAR(255) DEFAULT 'carbon.super',
UNIQUE (CONSUMER_KEY),
PRIMARY KEY (ID)
) ENGINE=InnoDB;
-- BotDATA Email table --
CREATE TABLE IF NOT EXISTS AM_NOTIFICATION_SUBSCRIBER (
UUID VARCHAR(255),
CATEGORY VARCHAR(255),
NOTIFICATION_METHOD VARCHAR(255),
SUBSCRIBER_ADDRESS VARCHAR(255) NOT NULL,
PRIMARY KEY(UUID, SUBSCRIBER_ADDRESS)
) ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_REVOKED_JWT (
UUID VARCHAR(255) NOT NULL,
SIGNATURE VARCHAR(2048) NOT NULL,
EXPIRY_TIMESTAMP BIGINT NOT NULL,
TENANT_ID INTEGER DEFAULT -1,
TOKEN_TYPE VARCHAR(15) DEFAULT 'DEFAULT',
TIME_CREATED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (UUID)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS AM_API_CATEGORIES (
UUID VARCHAR(50),
NAME VARCHAR(255),
DESCRIPTION VARCHAR(1024),
TENANT_ID INTEGER DEFAULT -1,
UNIQUE (NAME,TENANT_ID),
PRIMARY KEY (UUID)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS AM_USER (
USER_ID VARCHAR(255) NOT NULL,
USER_NAME VARCHAR(255) NOT NULL,
PRIMARY KEY(USER_ID)
) ENGINE=InnoDB;
-- Tenant Themes Table --
CREATE TABLE IF NOT EXISTS AM_TENANT_THEMES (
TENANT_ID INTEGER NOT NULL,
THEME MEDIUMBLOB NOT NULL,
PRIMARY KEY (TENANT_ID)
) ENGINE=InnoDB;
-- End of API-MGT Tables --
-- UMA tables --
CREATE TABLE IF NOT EXISTS IDN_UMA_RESOURCE (
ID INTEGER AUTO_INCREMENT NOT NULL,
RESOURCE_ID VARCHAR(255),
RESOURCE_NAME VARCHAR(255),
TIME_CREATED TIMESTAMP NOT NULL,
RESOURCE_OWNER_NAME VARCHAR(255),
CLIENT_ID VARCHAR(255),
TENANT_ID INTEGER DEFAULT -1234,
USER_DOMAIN VARCHAR(50),
PRIMARY KEY (ID)
);
CREATE INDEX IDX_RID ON IDN_UMA_RESOURCE (RESOURCE_ID);
CREATE INDEX IDX_USER ON IDN_UMA_RESOURCE (RESOURCE_OWNER_NAME, USER_DOMAIN);
CREATE TABLE IF NOT EXISTS IDN_UMA_RESOURCE_META_DATA (
ID INTEGER AUTO_INCREMENT NOT NULL,
RESOURCE_IDENTITY INTEGER NOT NULL,
PROPERTY_KEY VARCHAR(40),
PROPERTY_VALUE VARCHAR(255),
PRIMARY KEY (ID),
FOREIGN KEY (RESOURCE_IDENTITY) REFERENCES IDN_UMA_RESOURCE (ID) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS IDN_UMA_RESOURCE_SCOPE (
ID INTEGER AUTO_INCREMENT NOT NULL,
RESOURCE_IDENTITY INTEGER NOT NULL,
SCOPE_NAME VARCHAR(255),
PRIMARY KEY (ID),
FOREIGN KEY (RESOURCE_IDENTITY) REFERENCES IDN_UMA_RESOURCE (ID) ON DELETE CASCADE
);
CREATE INDEX IDX_RS ON IDN_UMA_RESOURCE_SCOPE (SCOPE_NAME);
CREATE TABLE IF NOT EXISTS IDN_UMA_PERMISSION_TICKET (
ID INTEGER AUTO_INCREMENT NOT NULL,
PT VARCHAR(255) NOT NULL,
TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
EXPIRY_TIME TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
TICKET_STATE VARCHAR(25) DEFAULT 'ACTIVE',
TENANT_ID INTEGER DEFAULT -1234,
PRIMARY KEY (ID)
);
CREATE INDEX IDX_PT ON IDN_UMA_PERMISSION_TICKET (PT);
CREATE TABLE IF NOT EXISTS IDN_UMA_PT_RESOURCE (
ID INTEGER AUTO_INCREMENT NOT NULL,
PT_RESOURCE_ID INTEGER NOT NULL,
PT_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (PT_ID) REFERENCES IDN_UMA_PERMISSION_TICKET (ID) ON DELETE CASCADE,
FOREIGN KEY (PT_RESOURCE_ID) REFERENCES IDN_UMA_RESOURCE (ID) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS IDN_UMA_PT_RESOURCE_SCOPE (
ID INTEGER AUTO_INCREMENT NOT NULL,
PT_RESOURCE_ID INTEGER NOT NULL,
PT_SCOPE_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (PT_RESOURCE_ID) REFERENCES IDN_UMA_PT_RESOURCE (ID) ON DELETE CASCADE,
FOREIGN KEY (PT_SCOPE_ID) REFERENCES IDN_UMA_RESOURCE_SCOPE (ID) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS AM_USER (
USER_ID VARCHAR(255) NOT NULL,
USER_NAME VARCHAR(255) NOT NULL,
PRIMARY KEY(USER_ID)
);
CREATE TABLE IF NOT EXISTS AM_KEY_MANAGER (
UUID VARCHAR(50) NOT NULL,
NAME VARCHAR(100) NULL,
DISPLAY_NAME VARCHAR(100) NULL,
DESCRIPTION VARCHAR(256) NULL,
TYPE VARCHAR(45) NULL,
CONFIGURATION BLOB NULL,
ENABLED BOOLEAN DEFAULT 1,
TENANT_DOMAIN VARCHAR(100) NULL,
PRIMARY KEY (UUID),
UNIQUE (NAME,TENANT_DOMAIN)
);
-- AM_GW_PUBLISHED_API_DETAILS & AM_GW_API_ARTIFACTS are independent tables for Artifact synchronizer feature which --
-- should not have any referential integrity constraints with other tables in AM database--
CREATE TABLE IF NOT EXISTS AM_GW_PUBLISHED_API_DETAILS (
API_ID varchar(255) NOT NULL,
TENANT_DOMAIN varchar(255),
API_PROVIDER varchar(255),
API_NAME varchar(255),
API_VERSION varchar(255),
PRIMARY KEY (API_ID)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS AM_GW_API_ARTIFACTS (
API_ID varchar(255) NOT NULL,
ARTIFACT LONGBLOB,
GATEWAY_INSTRUCTION varchar(20),
GATEWAY_LABEL varchar(255),
TIME_STAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (GATEWAY_LABEL, API_ID),
FOREIGN KEY (API_ID) REFERENCES AM_GW_PUBLISHED_API_DETAILS(API_ID) ON UPDATE CASCADE ON DELETE NO ACTION
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS AM_SCOPE (
SCOPE_ID INTEGER NOT NULL AUTO_INCREMENT,
NAME VARCHAR(255) NOT NULL,
DISPLAY_NAME VARCHAR(255) NOT NULL,
DESCRIPTION VARCHAR(512),
TENANT_ID INTEGER NOT NULL DEFAULT -1,
SCOPE_TYPE VARCHAR(255) NOT NULL,
PRIMARY KEY (SCOPE_ID)
)ENGINE INNODB;
CREATE TABLE IF NOT EXISTS AM_SCOPE_BINDING (
SCOPE_ID INTEGER NOT NULL,
SCOPE_BINDING VARCHAR(255) NOT NULL,
BINDING_TYPE VARCHAR(255) NOT NULL,
FOREIGN KEY (SCOPE_ID) REFERENCES AM_SCOPE (SCOPE_ID) ON DELETE CASCADE
)ENGINE INNODB;
-- Performance indexes start--
create index IDX_ITS_LMT on IDN_THRIFT_SESSION (LAST_MODIFIED_TIME);
create index IDX_IOAT_UT on IDN_OAUTH2_ACCESS_TOKEN (USER_TYPE);
create index IDX_AAI_CTX on AM_API (CONTEXT);
create index IDX_AAKM_CK on AM_APPLICATION_KEY_MAPPING (CONSUMER_KEY);
create index IDX_AAUM_AI on AM_API_URL_MAPPING (API_ID);
create index IDX_AAPM_AI on AM_API_PRODUCT_MAPPING (API_ID);
create index IDX_AAUM_TT on AM_API_URL_MAPPING (THROTTLING_TIER);
create index IDX_AATP_DQT on AM_API_THROTTLE_POLICY (DEFAULT_QUOTA_TYPE);
create index IDX_ACG_QT on AM_CONDITION_GROUP (QUOTA_TYPE);
create index IDX_APS_QT on AM_POLICY_SUBSCRIPTION (QUOTA_TYPE);
create index IDX_AS_AITIAI on AM_SUBSCRIPTION (API_ID,TIER_ID,APPLICATION_ID);
create index IDX_APA_QT on AM_POLICY_APPLICATION (QUOTA_TYPE);
create index IDX_AA_AT_CB on AM_APPLICATION (APPLICATION_TIER,CREATED_BY);
-- Performance indexes end--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment