mirror of
https://github.com/strapi/strapi.git
synced 2025-08-12 18:53:23 +00:00
14 lines
677 B
Plaintext
14 lines
677 B
Plaintext
![]() |
|
||
|
/**
|
||
|
* 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)
|
||
|
}),
|