-
I think I got real close, but ultimately ran in to a roadblock. I'm trying to run Ghost CMS locally before deploying to my server but ran into a
Received: Which ....makes sense because my database I created in the PlanetScale UI is called |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi @uncvrd 👋 I don't have any previous experience with Ghost so it's possible I'm missing something, but it looks there are at least a couple of big blockers here.
$ mysqldump -u root --no-data ghost_dev > ghost_dev_schema.sql
$ pscale shell ghost setup < ghost_dev_schema.sql
ERROR 1317 (70100) at line 105: foreign key constraints are not allowed, see https://vitess.io/blog/2021-06-15-online-ddl-why-no-fk/
Error: exit status 1
$ grep CONSTRAINT ghost_dev_schema.sql
CONSTRAINT `email_batches_email_id_foreign` FOREIGN KEY (`email_id`) REFERENCES `emails` (`id`)
CONSTRAINT `email_recipients_batch_id_foreign` FOREIGN KEY (`batch_id`) REFERENCES `email_batches` (`id`),
CONSTRAINT `email_recipients_email_id_foreign` FOREIGN KEY (`email_id`) REFERENCES `emails` (`id`)
CONSTRAINT `members_email_change_events_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE
CONSTRAINT `members_labels_label_id_foreign` FOREIGN KEY (`label_id`) REFERENCES `labels` (`id`) ON DELETE CASCADE,
CONSTRAINT `members_labels_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE
CONSTRAINT `members_login_events_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE
CONSTRAINT `members_paid_subscription_events_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE
CONSTRAINT `members_payment_events_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE
CONSTRAINT `members_products_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE,
CONSTRAINT `members_products_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
CONSTRAINT `members_status_events_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE
CONSTRAINT `members_stripe_customers_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE
CONSTRAINT `members_stripe_customers_subscriptions_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `members_stripe_customers` (`customer_id`) ON DELETE CASCADE
CONSTRAINT `members_subscribe_events_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) ON DELETE CASCADE
CONSTRAINT `oauth_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
CONSTRAINT `posts_authors_author_id_foreign` FOREIGN KEY (`author_id`) REFERENCES `users` (`id`),
CONSTRAINT `posts_authors_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`)
CONSTRAINT `posts_meta_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`)
CONSTRAINT `posts_tags_post_id_foreign` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`),
CONSTRAINT `posts_tags_tag_id_foreign` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`)
CONSTRAINT `products_benefits_benefit_id_foreign` FOREIGN KEY (`benefit_id`) REFERENCES `benefits` (`id`) ON DELETE CASCADE,
CONSTRAINT `products_benefits_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
CONSTRAINT `stripe_prices_stripe_product_id_foreign` FOREIGN KEY (`stripe_product_id`) REFERENCES `stripe_products` (`stripe_product_id`)
CONSTRAINT `stripe_products_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
CONSTRAINT `webhooks_integration_id_foreign` FOREIGN KEY (`integration_id`) REFERENCES `integrations` (`id`) ON DELETE CASCADE I'd be happy to hear otherwise, but if this is what an average Ghost DB schema looks like I don't think Ghost and PlanetScale are very compatible in their current states. |
Beta Was this translation helpful? Give feedback.
-
This may be solved soon: Planetscale launches foreign key constraint support in beta 🚀 🎉 |
Beta Was this translation helpful? Give feedback.
-
PlanetScale now supports foreign key constraints! There are some incompatibilities left, i.e., database creation mentioned by @jgreet, but I made a small patch to Ghost to finally make it work! I created a guide if you want a quick setup here . I also made an example repository here if you want to play with it. Let me know if you have any troubles with replication. |
Beta Was this translation helpful? Give feedback.
Hi @uncvrd 👋 I don't have any previous experience with Ghost so it's possible I'm missing something, but it looks there are at least a couple of big blockers here.
It doesn't appear that there's a ghost CLI option to run the initial setup without attempting to create the database, or any other built-in workaround for the problem you encountered.
To see what might be possible, I installed Ghost locally and dumped the database schema. Seems like it makes heavy use of foreign key constraints, a feature we don't support on PlanetScale (see #74). Attempting to import this schema directly will also fail.
$ mysqldump -u root --no-data ghost_dev > ghost_dev_schema.sql $ pscale shell ghost s…