20 lines
794 B
Plaintext
Raw Normal View History

2016-03-18 11:12:50 +01:00
/**
* Select the `<%= tableName %>` table.
*/
<% if (toDrop === true) { %>
connection.schema.table('<%= tableName %>', function (table) {
<% if (!_.isEmpty(attributes)) { _.forEach(attributes, function(details, attribute) { %><%= models[tableName].attributes[attribute].create.drop %>;
<% }); } %>
}).catch(function (err) {
console.log('Impossible to select the `<%= tableName %>` table.');
console.log(err);
}), <% } else { %>
2016-03-18 11:12:50 +01:00
connection.schema.table('<%= tableName %>', function (table) {
<% if (!_.isEmpty(attributes)) { _.forEach(attributes, function(details, attribute) { %><%= models[tableName].attributes[attribute].create.others %>;
2016-03-18 11:12:50 +01:00
<% }); } %>
}).catch(function (err) {
console.log('Impossible to select the `<%= tableName %>` table.');
console.log(err);
}),<% } %>