Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt adding foreign keys back to messagecategory #308

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

squeaky-pl
Copy link
Contributor

@squeaky-pl squeaky-pl commented Jan 13, 2022

Migration pending, notice that this is enough for tests because the schema is created from models in pytest:

MailSyncBase.metadata.create_all(engine)

(Pdb) engine.execute("SHOW CREATE TABLE messagecategory").fetchall()
[('messagecategory', 'CREATE TABLE `messagecategory` (\n  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  `id` bigint(20) NOT NULL AUTO_INCREMENT,\n  `message ...
(377 characters truncated) ... NSTRAINT `messagecategory_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4')]

The important question is if there is a safe way to add such constraints on MySQL version we are using on those tables?

@jkemp101
Copy link
Member

I used set foreign_key_checks=OFF for this change closeio/nylas#63 (comment) and I think it worked fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants