This adds domains table and adjusts the apps and mailboxes table accordingly Also ensure we explicitly set the table collation, this is required for the foreign key from apps table (utf8) and the newly created domains table, which by default now would be utf8mb4 Put db table constraint for mailboxes.domain Update the schema file
16 lines
499 B
JavaScript
16 lines
499 B
JavaScript
'use strict';
|
|
|
|
exports.up = function(db, callback) {
|
|
db.runSql('ALTER TABLE mailboxes ADD CONSTRAINT mailboxes_domain_constraint FOREIGN KEY(domain) REFERENCES domains(domain)', function (error) {
|
|
if (error) console.error(error);
|
|
callback(error);
|
|
});
|
|
};
|
|
|
|
exports.down = function(db, callback) {
|
|
db.runSql('ALTER TABLE mailboxes DROP FOREIGN KEY mailboxes_domain_constraint', function (error) {
|
|
if (error) console.error(error);
|
|
callback(error);
|
|
});
|
|
};
|