mirror of
https://github.com/strapi/strapi.git
synced 2025-08-12 10:48:12 +00:00
14 lines
677 B
Plaintext
Executable File
14 lines
677 B
Plaintext
Executable File
|
|
/**
|
|
* Create the `<%= tableName %>` table to make relationships
|
|
* between `<%= details.collection %>` and `<%= relationship.collection %>`.
|
|
*/
|
|
|
|
connection.schema.createTableIfNotExists('<%= tableName %>', function (table) {
|
|
table.integer('<%= details.attribute %>_<%= details.column %>').unsigned().references('<%= details.column %>').inTable('<%= details.collection %>');
|
|
table.integer('<%= relationship.attribute %>_<%= relationship.column %>').unsigned().references('<%= relationship.column %>').inTable('<%= relationship.collection %>');
|
|
}).catch(function (err) {
|
|
console.log('Impossible to create the `<%= tableName %>` relation table.');
|
|
console.log(err)
|
|
}),
|