1534 tx_uuid CHAR(32) PRIMARY KEY NOT NULL, |
1534 tx_uuid CHAR(32) PRIMARY KEY NOT NULL, |
1535 tx_user INTEGER NOT NULL, |
1535 tx_user INTEGER NOT NULL, |
1536 tx_time %s NOT NULL |
1536 tx_time %s NOT NULL |
1537 );; |
1537 );; |
1538 CREATE INDEX transactions_tx_user_idx ON transactions(tx_user);; |
1538 CREATE INDEX transactions_tx_user_idx ON transactions(tx_user);; |
|
1539 CREATE INDEX transactions_tx_time_idx ON transactions(tx_time);; |
1539 |
1540 |
1540 CREATE TABLE tx_entity_actions ( |
1541 CREATE TABLE tx_entity_actions ( |
1541 tx_uuid CHAR(32) REFERENCES transactions(tx_uuid) ON DELETE CASCADE, |
1542 tx_uuid CHAR(32) REFERENCES transactions(tx_uuid) ON DELETE CASCADE, |
1542 txa_action CHAR(1) NOT NULL, |
1543 txa_action CHAR(1) NOT NULL, |
1543 txa_public %s NOT NULL, |
1544 txa_public %s NOT NULL, |
1548 );; |
1549 );; |
1549 CREATE INDEX tx_entity_actions_txa_action_idx ON tx_entity_actions(txa_action);; |
1550 CREATE INDEX tx_entity_actions_txa_action_idx ON tx_entity_actions(txa_action);; |
1550 CREATE INDEX tx_entity_actions_txa_public_idx ON tx_entity_actions(txa_public);; |
1551 CREATE INDEX tx_entity_actions_txa_public_idx ON tx_entity_actions(txa_public);; |
1551 CREATE INDEX tx_entity_actions_eid_idx ON tx_entity_actions(eid);; |
1552 CREATE INDEX tx_entity_actions_eid_idx ON tx_entity_actions(eid);; |
1552 CREATE INDEX tx_entity_actions_etype_idx ON tx_entity_actions(etype);; |
1553 CREATE INDEX tx_entity_actions_etype_idx ON tx_entity_actions(etype);; |
|
1554 CREATE INDEX tx_entity_actions_tx_uuid_idx ON tx_entity_actions(tx_uuid);; |
1553 |
1555 |
1554 CREATE TABLE tx_relation_actions ( |
1556 CREATE TABLE tx_relation_actions ( |
1555 tx_uuid CHAR(32) REFERENCES transactions(tx_uuid) ON DELETE CASCADE, |
1557 tx_uuid CHAR(32) REFERENCES transactions(tx_uuid) ON DELETE CASCADE, |
1556 txa_action CHAR(1) NOT NULL, |
1558 txa_action CHAR(1) NOT NULL, |
1557 txa_public %s NOT NULL, |
1559 txa_public %s NOT NULL, |
1562 );; |
1564 );; |
1563 CREATE INDEX tx_relation_actions_txa_action_idx ON tx_relation_actions(txa_action);; |
1565 CREATE INDEX tx_relation_actions_txa_action_idx ON tx_relation_actions(txa_action);; |
1564 CREATE INDEX tx_relation_actions_txa_public_idx ON tx_relation_actions(txa_public);; |
1566 CREATE INDEX tx_relation_actions_txa_public_idx ON tx_relation_actions(txa_public);; |
1565 CREATE INDEX tx_relation_actions_eid_from_idx ON tx_relation_actions(eid_from);; |
1567 CREATE INDEX tx_relation_actions_eid_from_idx ON tx_relation_actions(eid_from);; |
1566 CREATE INDEX tx_relation_actions_eid_to_idx ON tx_relation_actions(eid_to);; |
1568 CREATE INDEX tx_relation_actions_eid_to_idx ON tx_relation_actions(eid_to);; |
|
1569 CREATE INDEX tx_relation_actions_tx_uuid_idx ON tx_relation_actions(tx_uuid);; |
1567 """ % (helper.sql_create_sequence('entities_id_seq').replace(';', ';;'), |
1570 """ % (helper.sql_create_sequence('entities_id_seq').replace(';', ';;'), |
1568 typemap['Datetime'], typemap['Datetime'], typemap['Datetime'], |
1571 typemap['Datetime'], typemap['Datetime'], typemap['Datetime'], |
1569 typemap['Boolean'], typemap['Bytes'], typemap['Boolean']) |
1572 typemap['Boolean'], typemap['Bytes'], typemap['Boolean']) |
1570 if helper.backend_name == 'sqlite': |
1573 if helper.backend_name == 'sqlite': |
1571 # sqlite support the ON DELETE CASCADE syntax but do nothing |
1574 # sqlite support the ON DELETE CASCADE syntax but do nothing |