14 lines
590 B
Plaintext
Raw Normal View History

2016-03-18 11:12:50 +01:00
/**
* Create the `<%= tableName %>` table if it doesn't exist yet.
*/
connection.schema.createTableIfNotExists('<%= tableName %>', function (table) {<% if (_.isObject(options)) { _.forEach(options, function(value, option) { %><% if (models[tableName].options[option] !== false) { %>
<%= models[tableName][option] %>;<% } %><% }); } %>
<% _.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 create the `<%= tableName %>` table.');
console.log(err);
}),