mirror of
https://github.com/strapi/strapi.git
synced 2025-08-05 15:29:04 +00:00
14 lines
583 B
Plaintext
14 lines
583 B
Plaintext
![]() |
|
||
|
/**
|
||
|
* 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 %>;
|
||
|
<% }); %>
|
||
|
}).catch(function (err) {
|
||
|
console.log('Impossible to create the `<%= tableName %>` table.');
|
||
|
console.log(err);
|
||
|
}),
|