#✅ Directus w/ PlanetScale

1 messages · Page 1 of 1 (latest)

storm turtleBOT
#

Thanks for posting! This is a community powered server, so you may or may not get an answer based on available help and expertise. To increase your chances of somebody being able to help you, please help us help you making sure you:

  • Adding an explanation of exactly what you're trying to achieve.
  • Adding any and all related code or previous attempts.
  • Describing the exact issue or error you are facing.
  • Posting any screenshots if applicable.
  • Reading through https://stackoverflow.com/help/how-to-ask.

When you're done with this thread, please close it. Thanks! ✨

(If you have a support agreement and need help, please contact the core team via email.)

spring laurel
#

Planetscale isn’t actually using MySQL.

It’s Vitess, a MySQL compatible database so while some things will work, keep in mind that relationships and anything else that involves foreign key constraints will not, so most of directus.

https://planetscale.com/docs/reference/mysql-compatibility

obsidian coral
spring laurel
#

If you want to use any relationships between tables then yes, you’d want foreign key support.

#

Even in their site titles they tell you they are “mysql compatible” but never actually say “mysql”

obsidian coral
#

That sounds like it defeats the purpose of having a database altogether

#

Dang, the scaling, backups, and free tier looked very good. I don't know what my options are for Postgres (what I'm currently using with Directus).. AWS RDS maybe.. a pain to set up and maintain though.

spring laurel
#

I’d also look at railway which has both mysql and postgres and work well with vercel and netlify.

#

You won’t be able to host directus easily on vercel or netlify since directus is a long running application, some have done it, but it involves a lot of work (missed that in your original comment).

#

So I’d look at using railway or fly.io instead

obsidian coral
#

Looking at going from Docker install of Directus w/ Postgres locally to a free hosting provider to start with now

#

It seems that PlanetScale is still very powerful, and can scale to the edge of the universe, even with relational data

obsidian coral
#

"the lack of foreign keys does hurt things more than they say"
but is this only with Directus? Or with any sort of website you wanna build?
`Why not support foreign key constraints?
There are two major technical reasons why foreign key constraints are not supported:

The way FOREIGN KEY constraints are implemented in MySQL (or, rather, in the InnoDB storage engine) interferes with Online DDL operations. Learn more in this Vitess blog post.
Limited to single MySQL server scope, FOREIGN KEY constraints are impossible to maintain once your data grows and is split over multiple database servers. This typically happens when you introduce functional partitioning/sharding and/or horizontal sharding.
We believe the advantages of Online DDL such as branching, developer-owned schema changes and deployments, non-blocking schema changes, etc., and the advantages of sharding as means of unlimited scaling, outweigh the FOREIGN KEY constraints benefits.

In other words, if you enforce referential integrity at the application level instead of at the database level, you open the door to all of those benefits.

Note
You can still think in terms of foreign key relationships; of parent tables and child tables; of rows referencing each other. You can structure your tables in the exact same way without FOREIGN KEY constraints as you would with the constraints. It's just how these relationships are enforced that changes.`

#

@spring laurel from what I understand PlanetScale still handles relationships, but with this scalability in mind

#

in this video at this exact timestamp it talks about it a bit more: https://youtu.be/d7XJjQesDtE?t=271

Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap

Build a random quote machine with Nextjs, PlanetScale MySQL, & Drizzle ORM. In this tutorial, we'll set up a MySQL database on PlanetScale, connect to and query the database with Drizzle ORM, and build a Next.js frontend and API routes.

🚩 Subscribe ➜ https://bit.ly/3n...

▶ Play video
#

they are calling them foreign key "constraints"

late musk
obsidian coral
#

@spring laurel After further research into this, I'm not sure what you mean by your comment above? It’s Vitess, a MySQL compatible database so while some things will work, keep in mind that relationships and anything else that involves foreign keys will not.
Here it is explaining how Foreign Keys work via PlanetScale: https://planetscale.com/learn/courses/mysql-for-developers/indexes/foreign-keys?autoplay=1

Don't confuse foreign keys with foreign key constraints. This video explains the difference and explores both concepts in detail. Level up your MySQL skills today.

spring laurel
#

I shared with you their own doc above about what Vitess is compared to MySQL, not sure why you insist on continuing to argue the fact?

It’s not MySQL, so you won’t get full directus compatibility since relationships work using foreign key constraints.

They prefer to leave it for your ORM software to handle the relationships instead which isn’t how directus works, so let’s stop beating the dead horse on this as this conversation is over.

plucky sequoia
obsidian coral
# spring laurel I shared with you their own doc above about what Vitess is compared to MySQL, no...

Sorry, I'm just a bit confused and still learning about databases. PlanetScale has this video series called "MySQL for Developers" but if they don't even use MySQL I'm not sure what is the point of learning about this stuff if it won't be used in Vitess anyways. Or are you saying the ORM (Prisma, Drizzle, etc.) will handle this rather than PlanetScale?

Will we ever see Directus work with PlanetScale or is it just not possible?

obsidian coral
storm turtleBOT
#

✅ Directus w/ PlanetScale