Browse Source

fixed missing columns and cleaned xmls

lucaconte 6 years ago
parent
commit
49364dd2f2
2 changed files with 32 additions and 22 deletions
  1. 16 21
      docker/accountsdb.xml
  2. 16 1
      docker/messagedb.xml

+ 16 - 21
docker/accountsdb.xml

@@ -4,7 +4,8 @@
         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">
+         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"
+        logicalFilePath="migrations.xml">
 
     <changeSet id="1" author="moxie">
         <createTable tableName="accounts">
@@ -118,28 +119,8 @@
             </column>
         </createTable>
 
-        <createTable tableName="messages">
-            <column name="id" type="bigint" autoIncrement="true">
-                <constraints primaryKey="true" nullable="false"/>
-            </column>
-
-            <column name="account_id" type="bigint">
-                <constraints nullable="false"/>
-            </column>
 
-            <column name="device_id" type="bigint">
-                <constraints nullable="false"/>
-            </column>
-
-            <column name="encrypted_message" type="text">
-                <constraints nullable="false"/>
-            </column>
-        </createTable>
 
-        <createIndex tableName="messages" indexName="messages_account_and_device">
-            <column name="account_id"/>
-            <column name="device_id"/>
-        </createIndex>
 
     </changeSet>
 
@@ -171,4 +152,18 @@
     <changeSet id="4" author="moxie">
         <dropColumn tableName="keys" columnName="identity_key"/>
     </changeSet>
+
+    <changeSet id="5" author="moxie">
+        <addColumn tableName="pending_accounts">
+            <column name="timestamp" type="bigint" defaultValueComputed="extract(epoch from now()) * 1000">
+                <constraints nullable="false"/>
+            </column>
+        </addColumn>
+
+        <addColumn tableName="pending_devices">
+            <column name="timestamp" type="bigint" defaultValueComputed="extract(epoch from now()) * 1000">
+                <constraints nullable="false"/>
+            </column>
+        </addColumn>
+    </changeSet>
 </databaseChangeLog>

+ 16 - 1
docker/messagedb.xml

@@ -7,7 +7,6 @@
          http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
 
     <changeSet id="1" author="moxie">
-        <dropTable tableName="messages"/>
         <createTable tableName="messages">
             <column name="id" type="bigint" autoIncrement="true">
                 <constraints primaryKey="true" nullable="false"/>
@@ -44,6 +43,18 @@
             <column name="message" type="bytea">
                 <constraints nullable="false"/>
             </column>
+
+           <column name="account_id" type="bigint">
+               <constraints nullable="false"/>
+           </column>
+
+           <column name="device_id" type="bigint">
+               <constraints nullable="false"/>
+           </column>
+
+           <column name="encrypted_message" type="text">
+                <constraints nullable="false"/>
+           </column>
         </createTable>
 
         <createIndex tableName="messages" indexName="destination_index">
@@ -56,6 +67,10 @@
             <column name="destination_device"></column>
             <column name="type"></column>
         </createIndex>
+        <createIndex tableName="messages" indexName="messages_account_and_device">
+            <column name="account_id"/>
+            <column name="device_id"/>
+        </createIndex>
     </changeSet>
 
     <changeSet id="2" author="moxie">