All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sql.ocsp-init.xml Maven / Gradle / Ivy

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- 
 Maximal column size: 4k
  - DB2: PAGESIZE 4 k
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"
  logicalFilePath="ocsp-init.xml">
  <property name="x500name.type" value="VARCHAR(350)"/>
  <changeSet author="xipki" id="1">
    <!-- table DBSCHEMAINFO -->
    <createTable tableName="DBSCHEMA" remarks="database schema information">
      <column name="NAME" type="VARCHAR(45)">
        <constraints primaryKey="true" nullable="false"/>
      </column>
      <column name="VALUE2" type="VARCHAR(100)">
        <constraints nullable="false"/>
      </column>
    </createTable>
    <insert tableName="DBSCHEMA">
      <column name="NAME" value="VERSION"/>
      <column name="VALUE2" value="2"/>
    </insert>
    <insert tableName="DBSCHEMA">
      <column name="NAME" value="X500NAME_MAXLEN"/>
      <!-- must be the length of x500name.type -->
      <column name="VALUE2" value="350"/>
    </insert>
    <!-- table ISSUER -->
    <createTable tableName="ISSUER">
      <column name="ID" type="INT">
        <constraints primaryKey="true" nullable="false"/>
      </column>
      <column name="SUBJECT" type="${x500name.type}">
        <constraints nullable="false"/>
      </column>
      <column name="NBEFORE" type="BIGINT"
          remarks="notBefore of certificate, seconds since January 1, 1970, 00:00:00 GMT">
        <constraints nullable="false"/>
      </column>
      <column name="NAFTER" type="BIGINT"
          remarks="notAfter of certificate, seconds since January 1, 1970, 00:00:00 GMT">
        <constraints nullable="false"/>
      </column>
      <column name="S1C" type="CHAR(28)"
          remarks="base64 enoded SHA1 sum of the certificate">
        <constraints nullable="false"/>
      </column>
      <column defaultValueNumeric="0" name="REV" type="SMALLINT"
          remarks="whether the certificate is revoked"/>
      <column name="RR" type="SMALLINT"
          remarks="revocation reason"/>
      <column name="RT"  type="BIGINT"
          remarks="revocation time, seconds since January 1, 1970, 00:00:00 GMT"/>
      <column name="RIT" type="BIGINT" 
          remarks="revocation invalidity time, seconds since January 1, 1970, 00:00:00 GMT"/>
      <column name="CERT" type="VARCHAR(4000)">
        <constraints nullable="false"/>
      </column>
      <column name="CRL_INFO" type="VARCHAR(1000)"
          remarks="CRL information if this issuer is imported from a CRL"/>
    </createTable>
    <!-- table CERT -->
    <createTable tableName="CERT"
        remarks="certificate information">
      <column name="ID" type="BIGINT">
        <constraints primaryKey="true" nullable="false"/>
      </column>
      <column name="IID" type="INT"
          remarks="issuer id">
        <constraints nullable="false"/>
      </column>
      <column name="SN" type="VARCHAR(40)"
          remarks="serial number">
        <constraints nullable="false"/>
      </column>
      <column name="LUPDATE" type="BIGINT"
          remarks="last update of the this database entry, seconds since January 1, 1970, 00:00:00 GMT">
        <constraints nullable="false"/>
      </column>
      <column name="NBEFORE" type="BIGINT"
          remarks="notBefore of certificate, seconds since January 1, 1970, 00:00:00 GMT">
      </column>
      <column name="NAFTER" type="BIGINT"
          remarks="notAfter of certificate, seconds since January 1, 1970, 00:00:00 GMT">
      </column>
      <column name="REV" type="SMALLINT"
          remarks="whether the certificate is revoked">
        <constraints nullable="false"/>
      </column>
      <column name="RR" type="SMALLINT"
          remarks="revocation reason"/>
      <column name="RT"  type="BIGINT"
          remarks="revocation time, seconds since January 1, 1970, 00:00:00 GMT"/>
      <column name="RIT" type="BIGINT"
          remarks="revocation invalidity time, seconds since January 1, 1970, 00:00:00 GMT"/>
      <column name="PN" type="VARCHAR(45)"
          remarks="certificate profile name"/>
    </createTable>
    <addUniqueConstraint tableName="CERT" columnNames="IID, SN" constraintName="CONST_ISSUER_SN"/>
    <!-- table CERTHASH -->
    <createTable tableName="CHASH"
        remarks="hashes of certificates">
      <column name="CID" type="BIGINT"
          remarks="certificate id">
        <constraints primaryKey="true" nullable="false"/>
      </column>
      <column name="S1" type="CHAR(28)"
          remarks="base64 enoded SHA1 sum of the certificate">
        <constraints nullable="false"/>
      </column>
      <column name="S224" type="CHAR(40)"
          remarks="base64 enoded SHA1 sum of the certificate">
        <constraints nullable="false"/>
      </column>
      <column name="S256" type="CHAR(44)"
          remarks="base64 enoded SHA1 sum of the certificate">
        <constraints nullable="false"/>
      </column>
      <column name="S384" type="CHAR(64)"
          remarks="base64 enoded SHA1 sum of the certificate">
        <constraints nullable="false"/>
      </column>
      <column name="S512" type="CHAR(88)"
          remarks="base64 enoded SHA1 sum of the certificate">
        <constraints nullable="false"/>
      </column>
    </createTable>
    <!-- table RAWCERT -->
    <createTable tableName="CRAW"
        remarks="raw certificates">
      <column name="CID" type="BIGINT"
          remarks="certificate id">
        <constraints primaryKey="true" nullable="false"/>
      </column>
      <column name="SUBJECT" type="${x500name.type}"
          remarks="subject of the certificate">
        <constraints nullable="false"/>
      </column>
      <column name="CERT" type="VARCHAR(4000)"
          remarks="Base64 encoded Certificate">
        <constraints nullable="false"/>
      </column>
    </createTable>
  </changeSet>
  <!-- foreign key -->
  <changeSet author="xipki" id="2">
    <addForeignKeyConstraint constraintName="FK_CERT_ISSUER1"
      deferrable="false" initiallyDeferred="false"
      onDelete="NO ACTION" onUpdate="NO ACTION"
      baseColumnNames="IID" baseTableName="CERT"
      referencedColumnNames="ID" referencedTableName="ISSUER"/>
    <addForeignKeyConstraint constraintName="FK_CHASH_CERT1"
      deferrable="false" initiallyDeferred="false"
      onDelete="CASCADE" onUpdate="NO ACTION"
      baseColumnNames="CID" baseTableName="CHASH"
      referencedColumnNames="ID" referencedTableName="CERT"/>
    <addForeignKeyConstraint constraintName="FK_CRAW_CERT1"
      deferrable="false" initiallyDeferred="false"
      onDelete="CASCADE" onUpdate="NO ACTION"
      baseColumnNames="CID" baseTableName="CRAW"
      referencedColumnNames="ID" referencedTableName="CERT"/>
  </changeSet>
</databaseChangeLog>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy