Skip to content

Commit ac656e5

Browse files
committed
Changed default namesapce and node name
1 parent 41d84c1 commit ac656e5

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

lib/Migrator.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ public function initialize()
4949
$this->session->save();
5050
}
5151

52+
/**
53+
* Run the migration up (or down) until $to.
54+
*
55+
* If $to is 0 then all migrations will be reverted.
56+
* If $to is null then all migrations will be executed.
57+
*
58+
* @param string $to Version to run until
59+
* @param OutputInterface $output
60+
*
61+
* @return VersionInterface[] Executed migrations
62+
*/
5263
public function migrate($to = null, OutputInterface $output)
5364
{
5465
if ($to === null) {
@@ -95,4 +106,9 @@ public function migrate($to = null, OutputInterface $output)
95106

96107
return $versionsToExecute;
97108
}
109+
110+
public function getVersions()
111+
{
112+
return $this->versionCollection;
113+
}
98114
}

lib/VersionStorage.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class VersionStorage
1818
private $storageNodeName;
1919
private $initialized = false;
2020

21-
public function __construct(SessionInterface $session, $storageNodeName = 'phpcrMigrations:versions')
21+
public function __construct(SessionInterface $session, $storageNodeName = 'jcr:versions')
2222
{
2323
$this->session = $session;
2424
$this->storageNodeName = $storageNodeName;
@@ -35,11 +35,11 @@ public function init()
3535

3636
if (!$nodeTypeManager->hasNodeType('phpcrMigration:version')) {
3737
$nodeTypeManager->registerNodeTypesCnd(<<<EOT
38-
<phpcrMigrations = 'http://www.danteech.com/phpcr-migrations'>
39-
[phpcrMigrations:version] > nt:base, mix:created
38+
<phpcrmig = 'http://www.danteech.com/phpcr-migrations'>
39+
[phpcrmig:version] > nt:base, mix:created
4040
41-
[phpcrMigrations:versions] > nt:base
42-
+* (phpcrMigrations:version)
41+
[phpcrmig:versions] > nt:base
42+
+* (phpcrmig:version)
4343
EOT
4444
, true);
4545
}
@@ -49,7 +49,7 @@ public function init()
4949
if ($rootNode->hasNode($this->storageNodeName)) {
5050
$storageNode = $rootNode->getNode($this->storageNodeName);
5151
} else {
52-
$storageNode = $rootNode->addNode($this->storageNodeName, 'phpcrMigrations:versions');
52+
$storageNode = $rootNode->addNode($this->storageNodeName, 'phpcrmig:versions');
5353
}
5454

5555
$this->storageNode = $storageNode;
@@ -94,6 +94,6 @@ public function add($timestamp)
9494
{
9595
$this->init();
9696

97-
$node = $this->storageNode->addNode($timestamp, 'phpcrMigrations:version');
97+
$node = $this->storageNode->addNode($timestamp, 'phpcrmig:version');
9898
}
9999
}

0 commit comments

Comments
 (0)