queries:
  -
   mappings:
      CREATE_TABLE:
      INSERT_INTO_TABLE:
      IS_TABLE_EXISTS:
      SELECT_SNAPSHOT:
      SELECT_LAST_REVISION:
      SELECT_REVISIONS:
      DELETE_ROW_FROM_TABLE:
      DELETE_OLD_REVISIONS:
      COUNT_NUMBER_REVISIONS:
      DELETE_ALL_REVISIONS:

   type: default
   version: default

  -
   mappings:
      CREATE_TABLE: CREATE TABLE {{TABLE_NAME}} (id INT NOT NULL AUTO_INCREMENT, siddhiAppName VARCHAR(100), revision VARCHAR(300), snapshot LONGBLOB, PRIMARY KEY (id))
      INSERT_INTO_TABLE: INSERT INTO {{TABLE_NAME}} (siddhiAppName, revision, snapshot) VALUES (?, ?, ?)
      IS_TABLE_EXISTS: SELECT * FROM {{TABLE_NAME}} limit 1
      SELECT_SNAPSHOT: SELECT snapshot FROM {{TABLE_NAME}} WHERE  revision = ? AND siddhiAppName = ?
      SELECT_LAST_REVISION: SELECT revision FROM {{TABLE_NAME}} WHERE siddhiAppName = ? ORDER BY id DESC LIMIT 1
      SELECT_REVISIONS: SELECT revision FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
      DELETE_ROW_FROM_TABLE: DELETE FROM {{TABLE_NAME}} WHERE id IN (SELECT id FROM {{TABLE_NAME}} WHERE siddhiAppName = ? ORDER BY id ASC LIMIT ?)
      DELETE_OLD_REVISIONS: DELETE FROM {{TABLE_NAME}} WHERE revision IN (?) AND siddhiAppName = ?
      COUNT_NUMBER_REVISIONS: SELECT COUNT(*) FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
      DELETE_ALL_REVISIONS: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ?

   type: h2
   version: default

  -
   mappings:
      CREATE_TABLE: CREATE TABLE {{TABLE_NAME}} (id INT NOT NULL AUTO_INCREMENT, siddhiAppName VARCHAR(100), revision VARCHAR(300), snapshot LONGBLOB, PRIMARY KEY (id))
      INSERT_INTO_TABLE: INSERT INTO {{TABLE_NAME}} (siddhiAppName, revision, snapshot) VALUES (?, ?, ?)
      IS_TABLE_EXISTS: SELECT * FROM {{TABLE_NAME}} limit 1
      SELECT_SNAPSHOT: SELECT snapshot FROM {{TABLE_NAME}} WHERE  revision = ? AND siddhiAppName = ?
      SELECT_LAST_REVISION: SELECT revision FROM {{TABLE_NAME}} WHERE siddhiAppName = ? ORDER BY id DESC LIMIT 1
      SELECT_REVISIONS: SELECT revision FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
      DELETE_ROW_FROM_TABLE: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ? IS NOT NULL ORDER BY id ASC LIMIT ?
      DELETE_OLD_REVISIONS: DELETE FROM {{TABLE_NAME}} WHERE revision IN (?) AND siddhiAppName = ?
      COUNT_NUMBER_REVISIONS: SELECT COUNT(*) FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
      DELETE_ALL_REVISIONS: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ?

   type: mysql
   version: default

  -
   mappings:
      CREATE_TABLE: CREATE TABLE {{TABLE_NAME}} (id serial primary key, siddhiAppName VARCHAR(100), revision VARCHAR(300), snapshot bigint)
      INSERT_INTO_TABLE: INSERT INTO {{TABLE_NAME}} (siddhiAppName, revision, snapshot) VALUES (?, ?, ?)
      IS_TABLE_EXISTS: SELECT 1 FROM {{TABLE_NAME}} LIMIT 1
      SELECT_SNAPSHOT: SELECT snapshot FROM {{TABLE_NAME}} WHERE  revision = ? AND siddhiAppName = ?
      SELECT_LAST_REVISION: SELECT revision FROM {{TABLE_NAME}} WHERE siddhiAppName = ? ORDER BY id DESC LIMIT 1
      SELECT_REVISIONS: SELECT revision FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
      DELETE_ROW_FROM_TABLE: DELETE FROM {{TABLE_NAME}} WHERE id IN (SELECT id FROM {{TABLE_NAME}} WHERE siddhiAppName = ? ORDER BY id ASC LIMIT ?)
      DELETE_OLD_REVISIONS: DELETE FROM {{TABLE_NAME}} WHERE revision IN (?) AND siddhiAppName = ?
      COUNT_NUMBER_REVISIONS: SELECT COUNT(*) FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
      DELETE_ALL_REVISIONS: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ?

   type: postgresql
   version: default

  -
   mappings:
      CREATE_TABLE: CREATE TABLE {{TABLE_NAME}} (id INT NOT NULL IDENTITY(1,1) PRIMARY KEY, siddhiAppName VARCHAR(100), revision VARCHAR(300), snapshot VARBINARY(max))
      INSERT_INTO_TABLE: INSERT INTO {{TABLE_NAME}} (siddhiAppName, revision, snapshot) VALUES (?, ?, ?)
      IS_TABLE_EXISTS: SELECT TOP 1 1 FROM {{TABLE_NAME}}
      SELECT_SNAPSHOT: SELECT snapshot FROM {{TABLE_NAME}} WHERE  revision = ? AND siddhiAppName = ?
      SELECT_LAST_REVISION: SELECT TOP 1 revision FROM {{TABLE_NAME}} WHERE siddhiAppName = ? ORDER BY id DESC
      SELECT_REVISIONS: SELECT revision FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
      DELETE_ROW_FROM_TABLE: DELETE FROM {{TABLE_NAME}} WHERE id IN (SELECT TOP (?) id FROM {{TABLE_NAME}} WHERE siddhiAppName = ? ORDER BY id ASC)
      DELETE_OLD_REVISIONS: DELETE FROM {{TABLE_NAME}} WHERE revision IN (?) AND siddhiAppName = ?
      COUNT_NUMBER_REVISIONS: SELECT COUNT(*) FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
      DELETE_ALL_REVISIONS: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ?

   type: microsoft sql server
   version: default

  -
   mappings:
      CREATE_TABLE: CREATE TABLE {{TABLE_NAME}} (siddhiAppName VARCHAR2(100) NOT NULL, revision VARCHAR2(100), snapshot BLOB)
      INSERT_INTO_TABLE: INSERT INTO {{TABLE_NAME}} (siddhiAppName, revision, snapshot) VALUES (?, ?, ?)
      IS_TABLE_EXISTS: SELECT 1 FROM {{TABLE_NAME}} WHERE rownum=1
      SELECT_SNAPSHOT: SELECT snapshot FROM {{TABLE_NAME}} WHERE  revision = ? AND siddhiAppName = ?
      SELECT_LAST_REVISION: SELECT revision FROM (SELECT revision FROM {{TABLE_NAME}} WHERE siddhiAppName = ? ORDER BY revision DESC) WHERE rownum=1
      SELECT_REVISIONS: SELECT revision FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
      DELETE_ROW_FROM_TABLE: DELETE {{TABLE_NAME}} WHERE revision in (SELECT revision FROM (SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ? ORDER BY revision ASC) WHERE rownum<=?)
      DELETE_OLD_REVISIONS: DELETE FROM {{TABLE_NAME}} WHERE revision in (?) AND siddhiAppName = ?
      COUNT_NUMBER_REVISIONS: SELECT COUNT(*) FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
      DELETE_ALL_REVISIONS: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ?

   type: oracle
   version: default

  -
   mappings:
      CREATE_TABLE: CREATE TABLE {{TABLE_NAME}} (id INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL, siddhiAppName VARCHAR(100), revision VARCHAR(300), snapshot BLOB(2000000000), PRIMARY KEY (id))
      INSERT_INTO_TABLE: INSERT INTO {{TABLE_NAME}} (siddhiAppName, revision, snapshot) VALUES (?, ?, ?)
      IS_TABLE_EXISTS: SELECT * FROM {{TABLE_NAME}} FETCH FIRST 1 ROWS ONLY
      SELECT_SNAPSHOT: SELECT snapshot FROM {{TABLE_NAME}} WHERE  revision = ? AND siddhiAppName = ?
      SELECT_LAST_REVISION: SELECT revision FROM {{TABLE_NAME}} WHERE siddhiAppName = ? ORDER BY id DESC LIMIT 1
      SELECT_REVISIONS: SELECT revision FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
      DELETE_ROW_FROM_TABLE: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ? IS NOT NULL ORDER BY id ASC LIMIT ?
      DELETE_OLD_REVISIONS: DELETE FROM {{TABLE_NAME}} WHERE revision IN (?) AND siddhiAppName = ?
      COUNT_NUMBER_REVISIONS: SELECT COUNT(*) FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
      DELETE_ALL_REVISIONS: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ?

   type: db2
   version: default
