mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-02-11 00:08:26 -05:00
Add appservice txns sql schema
This commit is contained in:
parent
64345b7559
commit
01c099d9ef
@ -57,7 +57,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
# Remember to update this number every time a change is made to database
|
# Remember to update this number every time a change is made to database
|
||||||
# schema files, so the users will be informed on server restarts.
|
# schema files, so the users will be informed on server restarts.
|
||||||
SCHEMA_VERSION = 14
|
SCHEMA_VERSION = 15
|
||||||
|
|
||||||
dir_path = os.path.abspath(os.path.dirname(__file__))
|
dir_path = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
@ -385,6 +385,8 @@ class ApplicationServiceTransactionStore(SQLBaseStore):
|
|||||||
Returns:
|
Returns:
|
||||||
AppServiceTransaction: A new transaction.
|
AppServiceTransaction: A new transaction.
|
||||||
"""
|
"""
|
||||||
|
# TODO: work out txn id (highest txn id for this service += 1)
|
||||||
|
# TODO: Within same db transaction, Insert new txn into txn table
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def complete_appservice_txn(self, txn_id, service):
|
def complete_appservice_txn(self, txn_id, service):
|
||||||
@ -398,6 +400,8 @@ class ApplicationServiceTransactionStore(SQLBaseStore):
|
|||||||
A Deferred which resolves to True if this transaction was completed
|
A Deferred which resolves to True if this transaction was completed
|
||||||
successfully.
|
successfully.
|
||||||
"""
|
"""
|
||||||
|
# TODO: Set current txn_id for AS to 'txn_id'
|
||||||
|
# TODO: Delete txn contents
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_oldest_unsent_txn(self, service):
|
def get_oldest_unsent_txn(self, service):
|
||||||
@ -410,4 +414,6 @@ class ApplicationServiceTransactionStore(SQLBaseStore):
|
|||||||
A Deferred which resolves to an AppServiceTransaction or
|
A Deferred which resolves to an AppServiceTransaction or
|
||||||
None.
|
None.
|
||||||
"""
|
"""
|
||||||
|
# TODO: Monotonically increasing txn ids, so just select the smallest
|
||||||
|
# one in the txns table (we delete them when they are sent)
|
||||||
pass
|
pass
|
||||||
|
31
synapse/storage/schema/delta/15/appservice_txns.sql
Normal file
31
synapse/storage/schema/delta/15/appservice_txns.sql
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/* Copyright 2015 OpenMarket Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS application_services_state(
|
||||||
|
as_id INTEGER PRIMARY KEY,
|
||||||
|
state TEXT NOT NULL,
|
||||||
|
last_txn TEXT,
|
||||||
|
FOREIGN KEY(as_id) REFERENCES application_services(id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS application_services_txns(
|
||||||
|
as_id INTEGER NOT NULL,
|
||||||
|
txn_id INTEGER NOT NULL,
|
||||||
|
content TEXT NOT NULL,
|
||||||
|
UNIQUE(as_id, txn_id) ON CONFLICT ROLLBACK
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user