mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 19:28:05 +01:00
Remove message database from the codebase (#395)
* Remove message database from the codebase * Remove unused ExperimentEnrollmentManager in test * Be more stylish
This commit is contained in:
@@ -1,139 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright 2013-2020 Signal Messenger, LLC
|
||||
~ SPDX-License-Identifier: AGPL-3.0-only
|
||||
-->
|
||||
|
||||
<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">
|
||||
|
||||
<changeSet id="1" author="moxie">
|
||||
<createTable tableName="messages">
|
||||
<column name="id" type="bigint" autoIncrement="true">
|
||||
<constraints primaryKey="true" nullable="false"/>
|
||||
</column>
|
||||
|
||||
<column name="type" type="tinyint">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
|
||||
<column name="relay" type="text">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
|
||||
<column name="timestamp" type="bigint">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
|
||||
<column name="source" type="text">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
|
||||
<column name="source_device" type="int">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
|
||||
<column name="destination" type="text">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
|
||||
<column name="destination_device" type="int">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
|
||||
<column name="message" type="bytea">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</createTable>
|
||||
|
||||
<createIndex tableName="messages" indexName="destination_index">
|
||||
<column name="destination"></column>
|
||||
<column name="destination_device"></column>
|
||||
</createIndex>
|
||||
|
||||
<createIndex tableName="messages" indexName="destination_and_type_index">
|
||||
<column name="destination"></column>
|
||||
<column name="destination_device"></column>
|
||||
<column name="type"></column>
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="2" author="moxie">
|
||||
<addColumn tableName="messages">
|
||||
<column name="content" type="bytea"/>
|
||||
</addColumn>
|
||||
|
||||
<dropNotNullConstraint tableName="messages" columnName="message"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="3" author="moxie">
|
||||
<sql>CREATE RULE bounded_message_queue AS ON INSERT TO messages DO ALSO DELETE FROM messages WHERE id IN (SELECT id FROM messages WHERE destination = NEW.destination AND destination_device = NEW.destination_device ORDER BY timestamp DESC OFFSET 5000);</sql>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="4" author="moxie">
|
||||
<sql>DROP RULE bounded_message_queue ON messages;</sql>
|
||||
<sql>CREATE RULE bounded_message_queue AS ON INSERT TO messages DO ALSO DELETE FROM messages WHERE id IN (SELECT id FROM messages WHERE destination = NEW.destination AND destination_device = NEW.destination_device ORDER BY timestamp DESC OFFSET 1000);</sql>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="5" author="moxie">
|
||||
<addColumn tableName="messages">
|
||||
<column name="deleted" type="integer"/>
|
||||
</addColumn>
|
||||
|
||||
<sql>DROP RULE bounded_message_queue ON messages;</sql>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="6" author="moxie">
|
||||
<sql>CREATE RULE bounded_message_queue AS ON INSERT TO messages DO ALSO DELETE FROM messages WHERE id IN (SELECT id FROM messages WHERE destination = NEW.destination AND destination_device = NEW.destination_device ORDER BY timestamp DESC OFFSET 1000);</sql>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="7" author="moxie">
|
||||
<dropColumn tableName="messages" columnName="deleted"/>
|
||||
|
||||
<sql>DROP RULE bounded_message_queue ON messages;</sql>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="8" author="moxie">
|
||||
<sql>CREATE RULE bounded_message_queue AS ON INSERT TO messages DO ALSO DELETE FROM messages WHERE id IN (SELECT id FROM messages WHERE destination = NEW.destination AND destination_device = NEW.destination_device ORDER BY timestamp DESC OFFSET 1000);</sql>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="9" author="moxie">
|
||||
<sql>DROP RULE bounded_message_queue ON messages;</sql>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="10" author="moxie">
|
||||
<sql>CREATE RULE bounded_message_queue AS ON INSERT TO messages DO ALSO DELETE FROM messages WHERE id IN (SELECT id FROM messages WHERE destination = NEW.destination AND destination_device = NEW.destination_device ORDER BY timestamp DESC OFFSET 1000);</sql>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="11" author="moxie">
|
||||
<addColumn tableName="messages">
|
||||
<column name="guid" type="uuid"/>
|
||||
</addColumn>
|
||||
|
||||
<addColumn tableName="messages">
|
||||
<column name="server_timestamp" type="bigint"/>
|
||||
</addColumn>
|
||||
|
||||
<dropNotNullConstraint tableName="messages" columnName="source"/>
|
||||
<dropNotNullConstraint tableName="messages" columnName="source_device"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="12" author="moxie" runInTransaction="false">
|
||||
<sql>CREATE INDEX CONCURRENTLY guid_index ON messages (guid);</sql>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="13" author="moxie">
|
||||
<addColumn tableName="messages">
|
||||
<column name="source_uuid" type="uuid"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
|
||||
<changeSet runInTransaction="false" id="14" author="ehren">
|
||||
<sql>DROP INDEX CONCURRENTLY IF EXISTS public.destination_index;</sql>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
Reference in New Issue
Block a user