Skip to content

Commit

Permalink
### Changed
Browse files Browse the repository at this point in the history
* Fixed EJS syntax errors in the `Install.php` migration
  • Loading branch information
khalwat committed Mar 14, 2017
1 parent 5e94ea3 commit e95eb6a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGLOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# generator-craftplugin Changelog

## 1.2.26 - 2017.03.14
### Changed
* Fixed EJS syntax errors in the `Install.php` migration

## 1.2.25 - 2017.03.14
### Changed
* Added `dateCreated`, `dateUpdated`, and `uid` to the `Install.php` migration
Expand Down
18 changes: 13 additions & 5 deletions app/templates/api_version_3_0/src/migrations/_Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected function createTables()
<% if ((typeof(records[0]) !== 'undefined') && (records[0] !== "")) { -%>
<% records.forEach(function(record, index, array){ -%>
<% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%>
// {{%<%= pluginDirName %>_<%= record.toLowerCase() %>}} table
// <%= pluginDirName %>_<%= record.toLowerCase() %> table
<% } else { -%>
<% } -%>
$this->createTable(
Expand Down Expand Up @@ -165,7 +165,7 @@ protected function createIndexes()
<% if ((typeof(records[0]) !== 'undefined') && (records[0] !== "")) { -%>
<% records.forEach(function(record, index, array){ -%>
<% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%>
// {{%<%= pluginDirName %>_<%= record.toLowerCase() %>}} table
// <%= pluginDirName %>_<%= record.toLowerCase() %> table
<% } else { -%>
<% } -%>
$this->createIndex(
Expand Down Expand Up @@ -205,8 +205,11 @@ protected function createIndexes()
<% } -%>
protected function addForeignKeys()
{
<% var records = recordName -%>
<% if ((typeof(records[0]) !== 'undefined') && (records[0] !== "")) { -%>
<% records.forEach(function(record, index, array){ -%>
<% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%>
// {{%<%= pluginDirName %>_<%= record.toLowerCase() %>}} table
// <%= pluginDirName %>_<%= record.toLowerCase() %> table
<% } else { -%>
<% } -%>
$this->addForeignKey(
Expand All @@ -218,6 +221,11 @@ protected function addForeignKeys()
'CASCADE',
'CASCADE'
);
<% if (index !== array.length - 1) { -%>

<% }; -%>
<% }); -%>
<% } -%>
}

<% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%>
Expand Down Expand Up @@ -252,7 +260,7 @@ protected function removeTables()
<% if ((typeof(records[0]) !== 'undefined') && (records[0] !== "")) { -%>
<% records.forEach(function(record, index, array){ -%>
<% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%>
// {{%<%= pluginDirName %>_<%= record.toLowerCase() %>}} table
// <%= pluginDirName %>_<%= record.toLowerCase() %> table
<% } else { -%>
<% } -%>
$this->dropTable('{{%<%= pluginDirName %>_<%= record.toLowerCase() %>}}');
Expand Down Expand Up @@ -280,7 +288,7 @@ protected function removeIndexes()
<% if ((typeof(records[0]) !== 'undefined') && (records[0] !== "")) { -%>
<% records.forEach(function(record, index, array){ -%>
<% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%>
// {{%<%= pluginDirName %>_<%= record.toLowerCase() %>}} table
// <%= pluginDirName %>_<%= record.toLowerCase() %> table
<% } else { -%>
<% } -%>
$this->dropIndex($this->db->getIndexName('{{%<%= pluginDirName %>_<%= record.toLowerCase() %>}}', 'some_field', true), '{{%<%= pluginDirName %>_<%= record.toLowerCase() %>}}');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-craftplugin",
"version": "1.2.25",
"version": "1.2.26",
"description": "generator-craftplugin is a Yeoman generator for Craft CMS plugins",
"main": "app/index.js",
"files": [
Expand Down

0 comments on commit e95eb6a

Please sign in to comment.