Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
meta.syncable: fix mysql to make sure it can be automatically install…
Browse files Browse the repository at this point in the history
…ed. Pass default driver to run installation.
  • Loading branch information
cdujeu committed Dec 18, 2013
1 parent 515743a commit 5a073d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion core/src/plugins/meta.syncable/class.ChangesTracker.php
Expand Up @@ -173,7 +173,7 @@ public function updateNodesIndex($oldNode = null, $newNode = null, $copy = false

public function installSQLTables($param)
{
$p = AJXP_Utils::cleanDibiDriverParameters($param["SQL_DRIVER"]);
$p = AJXP_Utils::cleanDibiDriverParameters($this->sqlDriver);
return AJXP_Utils::runCreateTablesQuery($p, $this->getBaseDir()."/create.sql");
}

Expand Down
23 changes: 8 additions & 15 deletions core/src/plugins/meta.syncable/create.mysql
Expand Up @@ -19,27 +19,20 @@ CREATE TABLE IF NOT EXISTS `ajxp_index` (
PRIMARY KEY (`node_id`)
);

--
-- Déclencheurs `ajxp_index`
--
DROP TRIGGER IF EXISTS `LOG_DELETE`;
DELIMITER //

CREATE TRIGGER `LOG_DELETE` AFTER DELETE ON `ajxp_index`
FOR EACH ROW INSERT INTO ajxp_changes (repository_identifier, node_id,source,target,type)
VALUES (old.repository_identifier, old.node_id, old.node_path, 'NULL', 'delete')
//
DELIMITER ;
VALUES (old.repository_identifier, old.node_id, old.node_path, 'NULL', 'delete');

DROP TRIGGER IF EXISTS `LOG_INSERT`;
DELIMITER //

CREATE TRIGGER `LOG_INSERT` AFTER INSERT ON `ajxp_index`
FOR EACH ROW INSERT INTO ajxp_changes (repository_identifier, node_id,source,target,type)
VALUES (new.repository_identifier, new.node_id, 'NULL', new.node_path, 'create')
//
DELIMITER ;
VALUES (new.repository_identifier, new.node_id, 'NULL', new.node_path, 'create');

DROP TRIGGER IF EXISTS `LOG_UPDATE`;
DELIMITER //

CREATE TRIGGER `LOG_UPDATE` AFTER UPDATE ON `ajxp_index`
FOR EACH ROW INSERT INTO ajxp_changes (repository_identifier, node_id,source,target,type)
VALUES (new.repository_identifier, new.node_id, old.node_path, new.node_path, CASE old.node_path = new.node_path WHEN true THEN 'content' ELSE 'path' END)
//
DELIMITER ;
VALUES (new.repository_identifier, new.node_id, old.node_path, new.node_path, CASE old.node_path = new.node_path WHEN true THEN 'content' ELSE 'path' END);

0 comments on commit 5a073d9

Please sign in to comment.