def prespi_create_container_table(self, conn):
 conn.executescript("\n        CREATE TABLE container (\n            ROWID INTEGER PRIMARY KEY AUTOINCREMENT,\n            name TEXT,\n            put_timestamp TEXT,\n            delete_timestamp TEXT,\n            object_count INTEGER,\n            bytes_used INTEGER,\n            deleted INTEGER DEFAULT 0\n        );\n\n        CREATE INDEX ix_container_deleted_name ON\n            container (deleted, name);\n\n        CREATE TRIGGER container_insert AFTER INSERT ON container\n        BEGIN\n            UPDATE account_stat\n            SET container_count = container_count + (1 - new.deleted),\n                object_count = object_count + new.object_count,\n                bytes_used = bytes_used + new.bytes_used,\n                hash = chexor(hash, new.name,\n                              new.put_timestamp || '-' ||\n                                new.delete_timestamp || '-' ||\n                                new.object_count || '-' || new.bytes_used);\n        END;\n\n        CREATE TRIGGER container_update BEFORE UPDATE ON container\n        BEGIN\n            SELECT RAISE(FAIL, 'UPDATE not allowed; DELETE and INSERT');\n        END;\n\n\n        CREATE TRIGGER container_delete AFTER DELETE ON container\n        BEGIN\n            UPDATE account_stat\n            SET container_count = container_count - (1 - old.deleted),\n                object_count = object_count - old.object_count,\n                bytes_used = bytes_used - old.bytes_used,\n                hash = chexor(hash, old.name,\n                              old.put_timestamp || '-' ||\n                                old.delete_timestamp || '-' ||\n                                old.object_count || '-' || old.bytes_used);\n        END;\n    ")

def prespi_create_container_table ( self , conn ) : conn . executescript ( "\n        CREATE TABLE container (\n            ROWID INTEGER PRIMARY KEY AUTOINCREMENT,\n            name TEXT,\n            put_timestamp TEXT,\n            delete_timestamp TEXT,\n            object_count INTEGER,\n            bytes_used INTEGER,\n            deleted INTEGER DEFAULT 0\n        );\n\n        CREATE INDEX ix_container_deleted_name ON\n            container (deleted, name);\n\n        CREATE TRIGGER container_insert AFTER INSERT ON container\n        BEGIN\n            UPDATE account_stat\n            SET container_count = container_count + (1 - new.deleted),\n                object_count = object_count + new.object_count,\n                bytes_used = bytes_used + new.bytes_used,\n                hash = chexor(hash, new.name,\n                              new.put_timestamp || '-' ||\n                                new.delete_timestamp || '-' ||\n                                new.object_count || '-' || new.bytes_used);\n        END;\n\n        CREATE TRIGGER container_update BEFORE UPDATE ON container\n        BEGIN\n            SELECT RAISE(FAIL, 'UPDATE not allowed; DELETE and INSERT');\n        END;\n\n\n        CREATE TRIGGER container_delete AFTER DELETE ON container\n        BEGIN\n            UPDATE account_stat\n            SET container_count = container_count - (1 - old.deleted),\n                object_count = object_count - old.object_count,\n                bytes_used = bytes_used - old.bytes_used,\n                hash = chexor(hash, old.name,\n                              old.put_timestamp || '-' ||\n                                old.delete_timestamp || '-' ||\n                                old.object_count || '-' || old.bytes_used);\n        END;\n    " )
copied from accountbroker before the sstoage_policy_index column was added; used for testing with testaccountbrokerbeforespi .