fix liquibase script when running on an empty postgresql database

This commit is contained in:
Jeremie Panzer
2020-03-12 13:40:23 +01:00
parent bb429afd95
commit b44e737448
5 changed files with 92 additions and 79 deletions

View File

@@ -11,7 +11,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<dropwizard.version>1.3.9</dropwizard.version>
<dropwizard.version>1.3.20</dropwizard.version>
<guice.version>4.2.2</guice.version>
<querydsl.version>4.2.1</querydsl.version>
<rome.version>1.5.0</rome.version>

View File

@@ -6,6 +6,7 @@
<changeSet author="athou" id="create-app-settings">
<validCheckSum>7:6d3ad493d25dd9c50067e804efc9ffcc</validCheckSum>
<validCheckSum>7:896a68c1651397288c40f717ce0397b4</validCheckSum>
<validCheckSum>8:1b0879c4739d483c3b1d779e08fe770b</validCheckSum>
<preConditions onFail="MARK_RAN" onFailMessage="existing table skipping">
<not>
<tableExists tableName="APPLICATIONSETTINGS" />
@@ -15,7 +16,7 @@
<column name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" />
</column>
<column name="allowRegistrations" type="BIT">
<column name="allowRegistrations" type="BOOLEAN">
<constraints nullable="false" />
</column>
<column name="backgroundThreads" type="INT">
@@ -29,20 +30,20 @@
<column name="smtpPort" type="INT">
<constraints nullable="false" />
</column>
<column name="smtpTls" type="BIT">
<column name="smtpTls" type="BOOLEAN">
<constraints nullable="false" />
</column>
<column name="smtpUserName" type="VARCHAR(255)" />
<column name="googleAnalyticsDomainName" type="VARCHAR(255)" />
<column name="googleAnalyticsTrackingCode" type="VARCHAR(255)" />
<column name="announcement" type="VARCHAR(255)" />
<column name="feedbackButton" type="BIT">
<column name="feedbackButton" type="BOOLEAN">
<constraints nullable="false" />
</column>
<column name="heavyLoad" type="BIT">
<column name="heavyLoad" type="BOOLEAN">
<constraints nullable="false" />
</column>
<column name="pubsubhubbub" type="BIT">
<column name="pubsubhubbub" type="BOOLEAN">
<constraints nullable="false" />
</column>
<column name="databaseUpdateThreads" type="INT">
@@ -79,6 +80,7 @@
<changeSet author="athou" id="create-cat">
<validCheckSum>7:93155e15f0feabe936e1de35711bf85b</validCheckSum>
<validCheckSum>7:c52f258e54d34156208cbfd2d8547fbd</validCheckSum>
<validCheckSum>8:c59e763e4cc7d59ae58d843937cf4e77</validCheckSum>
<preConditions onFail="MARK_RAN" onFailMessage="existing table skipping">
<not>
<tableExists tableName="FEEDCATEGORIES" />
@@ -88,7 +90,7 @@
<column name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" />
</column>
<column name="collapsed" type="BIT">
<column name="collapsed" type="BOOLEAN">
<constraints nullable="false" />
</column>
<column name="name" type="VARCHAR(128)">
@@ -160,6 +162,7 @@
<changeSet author="athou" id="create-statuses">
<validCheckSum>7:a9cf194a01c16b937a897aea934f09ae</validCheckSum>
<validCheckSum>7:6a386e0b08e98bdba9ce55e26ab90eba</validCheckSum>
<validCheckSum>8:ccfbff3df6f16c8686229c2da514e8b1</validCheckSum>
<preConditions onFail="MARK_RAN" onFailMessage="existing table skipping">
<not>
<tableExists tableName="FEEDENTRYSTATUSES" />
@@ -169,8 +172,8 @@
<column name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" />
</column>
<column name="read_status" type="BIT" />
<column name="starred" type="BIT">
<column name="read_status" type="BOOLEAN" />
<column name="starred" type="BOOLEAN">
<constraints nullable="false" />
</column>
<column name="entry_id" type="BIGINT">
@@ -298,6 +301,7 @@
<changeSet author="athou" id="create-users">
<validCheckSum>7:750e0990a8edebd0252df7d4adc7aa7c</validCheckSum>
<validCheckSum>8:dd1676f356c3c70822d69d5103947948</validCheckSum>
<preConditions onFail="MARK_RAN" onFailMessage="existing table skipping">
<not>
<tableExists tableName="USERS" />
@@ -307,17 +311,17 @@
<column name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" />
</column>
<column name="disabled" type="BIT">
<column name="disabled" type="BOOLEAN">
<constraints nullable="false" />
</column>
<column name="email" type="VARCHAR(255)" />
<column name="name" type="VARCHAR(32)">
<constraints nullable="false" />
</column>
<column name="password" type="BLOB">
<column name="password" type="${blob_type}">
<constraints nullable="false" />
</column>
<column name="salt" type="BLOB">
<column name="salt" type="${blob_type}">
<constraints nullable="false" />
</column>
<column name="lastLogin" type="DATETIME" />
@@ -333,6 +337,7 @@
<changeSet author="athou" id="create-user-settings">
<validCheckSum>7:985d6607a4350e032ea345d9a2f2f0c0</validCheckSum>
<validCheckSum>7:722eaff49d04d43c5b26da0929d3f707</validCheckSum>
<validCheckSum>8:451004f3bc72abac6a38d813881d3a87</validCheckSum>
<preConditions onFail="MARK_RAN" onFailMessage="existing table skipping">
<not>
<tableExists tableName="USERSETTINGS" />
@@ -349,16 +354,16 @@
<column name="readingOrder" type="VARCHAR(255)">
<constraints nullable="false" />
</column>
<column name="showRead" type="BIT">
<column name="showRead" type="BOOLEAN">
<constraints nullable="false" />
</column>
<column name="user_id" type="BIGINT">
<constraints nullable="false" />
</column>
<column name="socialButtons" type="BIT">
<column name="socialButtons" type="BOOLEAN">
<constraints nullable="false" />
</column>
<column name="scrollMarks" type="BIT">
<column name="scrollMarks" type="BOOLEAN">
<constraints nullable="false" />
</column>
<column name="viewMode" type="VARCHAR(255)">

View File

@@ -16,7 +16,7 @@
<column name="read_status" />
</createIndex>
</changeSet>
<changeSet author="athou" id="drop-fes-index">
<preConditions onFail="MARK_RAN" onFailMessage="index not found, skip drop index">
<indexExists tableName="FEEDENTRYSTATUSES" indexName="subscription_id" />
@@ -66,7 +66,7 @@
<column name="logLevel" type="VARCHAR(255)" />
</addColumn>
</changeSet>
<changeSet author="athou" id="add-push-hub">
<preConditions onFail="MARK_RAN" onFailMessage="column already exists">
<not>
@@ -78,7 +78,7 @@
<column name="pushHub" type="VARCHAR(2048)" />
</addColumn>
</changeSet>
<changeSet author="athou" id="add-push-topic">
<preConditions onFail="MARK_RAN" onFailMessage="column already exists">
<not>
@@ -90,7 +90,7 @@
<column name="pushTopic" type="VARCHAR(2048)" />
</addColumn>
</changeSet>
<changeSet author="athou" id="add-push-lastping">
<preConditions onFail="MARK_RAN" onFailMessage="column already exists">
<not>
@@ -102,7 +102,7 @@
<column name="pushLastPing" type="DATETIME" />
</addColumn>
</changeSet>
<changeSet author="athou" id="add-lastpublished">
<preConditions onFail="MARK_RAN" onFailMessage="column already exists">
<not>
@@ -113,8 +113,8 @@
<addColumn tableName="FEEDS">
<column name="lastPublishedDate" type="DATETIME" />
</addColumn>
</changeSet>
</changeSet>
<changeSet author="athou" id="add-lastcontenthash">
<preConditions onFail="MARK_RAN" onFailMessage="column already exists">
<not>
@@ -125,8 +125,8 @@
<addColumn tableName="FEEDS">
<column name="lastContentHash" type="VARCHAR(40)" />
</addColumn>
</changeSet>
</changeSet>
<changeSet author="athou" id="add-lastinterval">
<preConditions onFail="MARK_RAN" onFailMessage="column already exists">
<not>
@@ -137,8 +137,8 @@
<addColumn tableName="FEEDS">
<column name="averageEntryInterval" type="BIGINT" />
</addColumn>
</changeSet>
</changeSet>
<changeSet author="athou" id="add-lastentrydate">
<preConditions onFail="MARK_RAN" onFailMessage="column already exists">
<not>
@@ -150,7 +150,7 @@
<column name="lastEntryDate" type="DATETIME" />
</addColumn>
</changeSet>
<changeSet author="athou" id="add-cat-position">
<preConditions onFail="MARK_RAN" onFailMessage="column already exists">
<not>
@@ -162,7 +162,7 @@
<column name="position" type="INT" />
</addColumn>
</changeSet>
<changeSet author="athou" id="add-sub-position">
<preConditions onFail="MARK_RAN" onFailMessage="column already exists">
<not>
@@ -174,26 +174,26 @@
<column name="position" type="INT" />
</addColumn>
</changeSet>
<changeSet author="athou" id="drop-sequence">
<preConditions onFail="MARK_RAN" onFailMessage="table does not exist">
<tableExists tableName="hibernate_sequence" />
</preConditions>
<dropTable tableName="hibernate_sequence" />
</changeSet>
<changeSet author="athou" id="drop-old-pushinfos">
<preConditions onFail="MARK_RAN" onFailMessage="table does not exist">
<tableExists tableName="FEEDPUSHINFOS" />
</preConditions>
<dropTable tableName="FEEDPUSHINFOS" />
</changeSet>
<changeSet author="athou" id="add-topic-hash">
<addColumn tableName="FEEDS">
<column name="push_topic_hash" type="VARCHAR(40)" />
</addColumn>
<createIndex tableName="FEEDS" indexName="push_topic_hash_index">
<column name="push_topic_hash"></column>
</createIndex>
@@ -203,83 +203,85 @@
<addColumn tableName="FEEDENTRIES">
<column name="author" type="VARCHAR(128)" />
</addColumn>
</changeSet>
</changeSet>
<changeSet author="athou" id="add-inserted-index">
<createIndex tableName="FEEDENTRIES" indexName="inserted_index">
<column name="inserted"></column>
</createIndex>
</changeSet>
</changeSet>
<changeSet author="athou" id="rename-lang">
<renameColumn tableName="USERSETTINGS" oldColumnName="language" newColumnName="user_lang" columnDataType="VARCHAR(4)" />
</changeSet>
<changeSet author="athou" id="norwegian-migration">
<sql>update USERSETTINGS set user_lang='nb' where user_lang='no'</sql>
</changeSet>
<changeSet author="athou" id="add-user-created">
<validCheckSum>3:b1bbf8d559ac25b785751704f2d24a91</validCheckSum>
<validCheckSum>7:5bd8b28aadce012b56f003539ce99957</validCheckSum>
<addColumn tableName="USERS">
<column name="created" type="DATETIME" />
<column name="created" type="DATETIME" />
</addColumn>
</changeSet>
</changeSet>
<changeSet author="athou" id="add-proxy-setting">
<validCheckSum>7:ffca06665d2dc182bd3cb718e62e98f0</validCheckSum>
<validCheckSum>8:a1b2bfccb0b37fec8eb107220f76e3bd</validCheckSum>
<addColumn tableName="APPLICATIONSETTINGS">
<column name="imageProxyEnabled" type="BIT" />
<column name="imageProxyEnabled" type="BOOLEAN" />
</addColumn>
<update tableName="APPLICATIONSETTINGS">
<column name="imageProxyEnabled" valueBoolean="false"></column>
</update>
</update>
</changeSet>
<changeSet author="athou" id="add-query-timeout-setting">
<addColumn tableName="APPLICATIONSETTINGS">
<column name="queryTimeout" type="INT" />
<column name="queryTimeout" type="INT" />
</addColumn>
<update tableName="APPLICATIONSETTINGS">
<column name="queryTimeout" valueNumeric="0"></column>
</update>
</update>
</changeSet>
<changeSet author="athou" id="add-normalized-url">
<addColumn tableName="FEEDS">
<column name="normalizedUrl" type="VARCHAR(2048)" />
<column name="normalizedUrl" type="VARCHAR(2048)" />
</addColumn>
<addColumn tableName="FEEDS">
<column name="normalizedUrlHash" type="VARCHAR(40)" />
<column name="normalizedUrlHash" type="VARCHAR(40)" />
</addColumn>
<createIndex indexName="norm_url_hash_index" tableName="FEEDS"
unique="false">
<column name="normalizedUrlHash" />
</createIndex>
</changeSet>
<changeSet author="athou" id="add-pause-crawling">
<validCheckSum>8:4473505a94945268fcca0f2d77e4be4a</validCheckSum>
<addColumn tableName="APPLICATIONSETTINGS">
<column name="crawlingPaused" type="BIT" />
<column name="crawlingPaused" type="BOOLEAN" />
</addColumn>
<update tableName="APPLICATIONSETTINGS">
<column name="crawlingPaused" valueBoolean="false"></column>
</update>
</update>
</changeSet>
<changeSet author="athou" id="add-content-hash-index">
<createIndex tableName="FEEDS" indexName="last_content_hash_index">
<column name="lastContentHash"></column>
</createIndex>
</changeSet>
<changeSet author="athou" id="create-settings-index">
<createIndex tableName="USERSETTINGS" indexName="user_id_index" unique="true">
<column name="user_id"></column>
</createIndex>
</changeSet>
<changeSet author="athou" id="denormalize-statuses">
<validCheckSum>7:c73f70fbcbc8bb30f9629028ec8ddb06</validCheckSum>
<addColumn tableName="FEEDENTRYSTATUSES">
@@ -290,18 +292,18 @@
<column name="entryUpdated" type="DATETIME" />
</addColumn>
</changeSet>
<changeSet author="athou" id="populate-status-dates">
<validCheckSum>7:d6b5ab6920948b0a84e614870128e2f5</validCheckSum>
<sql>update FEEDENTRYSTATUSES SET entryUpdated = (select e.updated from FEEDENTRIES e where e.id = FEEDENTRYSTATUSES.entry_id)</sql>
</changeSet>
<changeSet author="athou" id="populate-status-users">
<validCheckSum>7:4227fdf2e7b9fe8e59544d536a7ee963</validCheckSum>
<sql>update FEEDENTRYSTATUSES SET user_id = (select sub.user_id from FEEDSUBSCRIPTIONS sub where sub.id = FEEDENTRYSTATUSES.subscription_id)</sql>
</changeSet>
<changeSet author="athou" id="recreate-fes-index-2">
<changeSet author="athou" id="recreate-fes-index-2">
<createIndex indexName="sub_entry_index" tableName="FEEDENTRYSTATUSES">
<column name="subscription_id" />
<column name="entry_id" />
@@ -317,28 +319,28 @@
<column name="entryUpdated" />
</createIndex>
</changeSet>
<changeSet author="athou" id="drop-fes-index-2">
<dropIndex tableName="FEEDENTRYSTATUSES" indexName="sub_entry_read_index" />
</changeSet>
<changeSet author="athou" id="add-entry-updated-to-ffe">
<addColumn tableName="FEED_FEEDENTRIES">
<column name="entryUpdated" type="DATETIME"></column>
</addColumn>
</changeSet>
<changeSet author="athou" id="populate-entry-dates">
<sql>update FEED_FEEDENTRIES SET entryUpdated = (select e.updated from FEEDENTRIES e where e.id = FEED_FEEDENTRIES.feedentry_id)</sql>
</changeSet>
<changeSet author="athou" id="create-ffe-entry-updated-index">
<createIndex tableName="FEED_FEEDENTRIES" indexName="feed_updated_index">
<column name="FEED_ID"></column>
<column name="entryUpdated"></column>
</createIndex>
</changeSet>
<changeSet author="athou" id="create-count-index">
<createIndex indexName="user_read_sub_index" tableName="FEEDENTRYSTATUSES">
<column name="user_id" />
@@ -346,21 +348,21 @@
<column name="subscription_id" />
</createIndex>
</changeSet>
<changeSet author="athou" id="add-trim-status-setting">
<addColumn tableName="APPLICATIONSETTINGS">
<column name="keepStatusDays" type="INT" />
<column name="keepStatusDays" type="INT" />
</addColumn>
<update tableName="APPLICATIONSETTINGS">
<column name="keepStatusDays" valueNumeric="0"></column>
</update>
</update>
</changeSet>
<changeSet author="athou" id="status-cleanup">
<validCheckSum>7:cf40ae235c2d4086c5fa6ac64102c6a9</validCheckSum>
<delete tableName="FEEDENTRYSTATUSES">
<where>read_status = false and starred = false</where>
</delete>
</changeSet>
</databaseChangeLog>

View File

@@ -3,35 +3,36 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="add-detailed-social-options" author="athou">
<validCheckSum>8:58e8060bba0ec9d448f4346eb35d815c</validCheckSum>
<addColumn tableName="USERSETTINGS">
<column name="email" type="BIT"></column>
<column name="email" type="BOOLEAN"></column>
</addColumn>
<addColumn tableName="USERSETTINGS">
<column name="gmail" type="BIT"></column>
<column name="gmail" type="BOOLEAN"></column>
</addColumn>
<addColumn tableName="USERSETTINGS">
<column name="facebook" type="BIT"></column>
<column name="facebook" type="BOOLEAN"></column>
</addColumn>
<addColumn tableName="USERSETTINGS">
<column name="twitter" type="BIT"></column>
<column name="twitter" type="BOOLEAN"></column>
</addColumn>
<addColumn tableName="USERSETTINGS">
<column name="googleplus" type="BIT"></column>
<column name="googleplus" type="BOOLEAN"></column>
</addColumn>
<addColumn tableName="USERSETTINGS">
<column name="tumblr" type="BIT"></column>
<column name="tumblr" type="BOOLEAN"></column>
</addColumn>
<addColumn tableName="USERSETTINGS">
<column name="pocket" type="BIT"></column>
<column name="pocket" type="BOOLEAN"></column>
</addColumn>
<addColumn tableName="USERSETTINGS">
<column name="instapaper" type="BIT"></column>
<column name="instapaper" type="BOOLEAN"></column>
</addColumn>
<addColumn tableName="USERSETTINGS">
<column name="buffer" type="BIT"></column>
<column name="buffer" type="BOOLEAN"></column>
</addColumn>
<addColumn tableName="USERSETTINGS">
<column name="readability" type="BIT"></column>
<column name="readability" type="BOOLEAN"></column>
</addColumn>
<dropColumn tableName="USERSETTINGS" columnName="socialButtons" />
@@ -49,7 +50,7 @@
<column name="readability" valueBoolean="true"></column>
</update>
</changeSet>
<changeSet id="delete-settings" author="athou">
<dropTable tableName="APPLICATIONSETTINGS" />
</changeSet>

View File

@@ -2,6 +2,11 @@
<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.1.xsd">
<property name="blob_type" value="bytea" dbms="postgresql"/>
<property name="blob_type" value="blob" dbms="h2" />
<property name="blob_type" value="blob" dbms="mysql" />
<property name="blob_type" value="blob" dbms="mssql" />
<include file="changelogs/db.changelog-1.0.xml" />
<include file="changelogs/db.changelog-1.1.xml" />