@itrocks/mysql-maintainer 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/mysql-maintainer.js
CHANGED
|
@@ -36,12 +36,13 @@ class MysqlMaintainer {
|
|
|
36
36
|
throw 'Collection objects are not stored';
|
|
37
37
|
}
|
|
38
38
|
const joinTable = (0, mysql_1.joinTableName)(table1, table2);
|
|
39
|
-
const query =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
const query = `CREATE TABLE \`${joinTable}\` (
|
|
40
|
+
${table1}_id int unsigned NOT NULL,
|
|
41
|
+
${table2}_id int unsigned NOT NULL,
|
|
42
|
+
PRIMARY KEY (${table1}_id, ${table2}_id),
|
|
43
|
+
CONSTRAINT \`${joinTable}.${table1}_id\` FOREIGN KEY (${table1}_id) REFERENCES \`${table1}\` (id) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
44
|
+
CONSTRAINT \`${joinTable}.${table2}_id\` FOREIGN KEY (${table2}_id) REFERENCES \`${table2}\` (id) ON DELETE CASCADE ON UPDATE CASCADE
|
|
45
|
+
)`;
|
|
45
46
|
await this.connection.query(query);
|
|
46
47
|
return true;
|
|
47
48
|
}
|
|
@@ -102,7 +103,7 @@ class MysqlMaintainer {
|
|
|
102
103
|
return false;
|
|
103
104
|
}
|
|
104
105
|
const schemaDiffMysql = new schema_diff_mysql_1.SchemaDiffMysql();
|
|
105
|
-
const sql = schemaDiffMysql.sql(schemaDiff
|
|
106
|
+
const sql = schemaDiffMysql.sql(schemaDiff);
|
|
106
107
|
await this.connection.query(sql);
|
|
107
108
|
return true;
|
|
108
109
|
}
|
package/esm/mysql-maintainer.js
CHANGED
|
@@ -19,12 +19,13 @@ export class MysqlMaintainer {
|
|
|
19
19
|
throw 'Collection objects are not stored';
|
|
20
20
|
}
|
|
21
21
|
const joinTable = joinTableName(table1, table2);
|
|
22
|
-
const query =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const query = `CREATE TABLE \`${joinTable}\` (
|
|
23
|
+
${table1}_id int unsigned NOT NULL,
|
|
24
|
+
${table2}_id int unsigned NOT NULL,
|
|
25
|
+
PRIMARY KEY (${table1}_id, ${table2}_id),
|
|
26
|
+
CONSTRAINT \`${joinTable}.${table1}_id\` FOREIGN KEY (${table1}_id) REFERENCES \`${table1}\` (id) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
27
|
+
CONSTRAINT \`${joinTable}.${table2}_id\` FOREIGN KEY (${table2}_id) REFERENCES \`${table2}\` (id) ON DELETE CASCADE ON UPDATE CASCADE
|
|
28
|
+
)`;
|
|
28
29
|
await this.connection.query(query);
|
|
29
30
|
return true;
|
|
30
31
|
}
|
|
@@ -85,7 +86,7 @@ export class MysqlMaintainer {
|
|
|
85
86
|
return false;
|
|
86
87
|
}
|
|
87
88
|
const schemaDiffMysql = new SchemaDiffMysql();
|
|
88
|
-
const sql = schemaDiffMysql.sql(schemaDiff
|
|
89
|
+
const sql = schemaDiffMysql.sql(schemaDiff);
|
|
89
90
|
await this.connection.query(sql);
|
|
90
91
|
return true;
|
|
91
92
|
}
|
package/package.json
CHANGED