yegor256/mailanes

View on GitHub
liquibase/2018/001-initial-schema.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0"?>
<!--
(The MIT License)

Copyright (c) 2018-2024 Yegor Bugayenko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<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-2.0.xsd" logicalFilePath="001-initial-schema.xml">
  <changeSet id="001" author="yegor256">
    <sql>
      CREATE TABLE list (
        id SERIAL PRIMARY KEY,
        owner VARCHAR(255) NOT NULL,
        yaml TEXT DEFAULT '' NOT NULL,
        created TIMESTAMP DEFAULT now() NOT NULL
      )
    </sql>
    <sql>
      CREATE TABLE recipient (
        id SERIAL PRIMARY KEY,
        email VARCHAR(255) NOT NULL,
        first VARCHAR(255) DEFAULT '' NOT NULL,
        last VARCHAR(255) DEFAULT '' NOT NULL,
        list INTEGER NOT NULL REFERENCES list(id),
        yaml TEXT DEFAULT '' NOT NULL,
        source VARCHAR(255) DEFAULT '' NOT NULL,
        created TIMESTAMP DEFAULT now() NOT NULL
      )
    </sql>
    <sql>
      CREATE TABLE lane (
        id SERIAL PRIMARY KEY,
        owner VARCHAR(255) NOT NULL,
        yaml TEXT DEFAULT '' NOT NULL,
        created TIMESTAMP DEFAULT now() NOT NULL
      )
    </sql>
    <sql>
      CREATE TABLE letter (
        id SERIAL PRIMARY KEY,
        lane INTEGER NOT NULL REFERENCES lane(id),
        active BOOLEAN DEFAULT false NOT NULL,
        liquid TEXT DEFAULT '' NOT NULL,
        yaml TEXT DEFAULT '' NOT NULL,
        created TIMESTAMP DEFAULT now() NOT NULL
      )
    </sql>
    <sql>
      CREATE TABLE campaign (
        id SERIAL PRIMARY KEY,
        list INTEGER NOT NULL REFERENCES list(id),
        lane INTEGER NOT NULL REFERENCES lane(id),
        active BOOLEAN DEFAULT false NOT NULL,
        yaml TEXT DEFAULT '' NOT NULL,
        created TIMESTAMP DEFAULT now() NOT NULL
      )
    </sql>
    <sql>
      CREATE TABLE delivery (
        id SERIAL PRIMARY KEY,
        recipient INTEGER NOT NULL REFERENCES recipient(id),
        campaign INTEGER NOT NULL REFERENCES campaign(id),
        letter INTEGER NOT NULL REFERENCES letter(id),
        details TEXT DEFAULT '' NOT NULL,
        created TIMESTAMP DEFAULT now() NOT NULL
      )
    </sql>
  </changeSet>
</databaseChangeLog>