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

feat(psl): GA fullTextIndex for every supported provider: mysql, mongodb #5052

Merged
merged 11 commits into from
Nov 25, 2024

Conversation

jkomyno
Copy link
Contributor

@jkomyno jkomyno commented Nov 22, 2024

This PR:


This PR implies that introspection of existing @fullText indexes works.
For example, with MongoDB:

  • Let $TEST_MONGO_URI be "mongodb://localhost:27018/tests"

  • Let's first run prisma db push on the following schema, which we call ./prisma/schema.prisma:

    // ./prisma/schema.prisma
    generator client {
      provider = "prisma-client-js"
    }
    
    datasource db {
      provider = "mongodb"
      url      = "mongodb://localhost:27018/tests"
    }
    
    model User {
      id   String @id @map("_id") @db.ObjectId
      name String
    
      @@fulltext([name])
    }
  • Let's delete the model User:

    // ./prisma/schema.prisma
    generator client {
      provider = "prisma-client-js"
    }
    
    datasource db {
      provider = "mongodb"
      url      = "mongodb://localhost:27018/tests"
    }
    
    - model User {
    -   id   String @id @map("_id") @db.ObjectId
    -   name String
    -
    -    @@fulltext([name])
    -  }
  • Now, we introspect the existing database. Let's run prisma db pull --url $TEST_MONGO_URI, which yields the following result:

    // ./prisma/schema.prisma
    generator client {
      provider = "prisma-client-js"
    }
    
    datasource db {
      provider = "mongodb"
      url      = "mongodb://localhost:27018/tests"
    }
    
    model User {
      id   String @id @map("_id") @db.ObjectId
      name String
    
      @@fulltext([name])
    }

As you can see, the full-text index on the name field is preserved as @@fulltext([name])

@jkomyno jkomyno requested a review from a team as a code owner November 22, 2024 13:47
@jkomyno jkomyno requested review from wmadden and aqrln and removed request for a team and wmadden November 22, 2024 13:47
@jkomyno jkomyno added this to the 6.0.0 milestone Nov 22, 2024
Copy link
Contributor

github-actions bot commented Nov 22, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.044MiB 2.044MiB 0.000B
Postgres (gzip) 820.491KiB 820.495KiB -4.000B
Mysql 2.010MiB 2.010MiB 0.000B
Mysql (gzip) 806.709KiB 806.675KiB 34.000B
Sqlite 1.907MiB 1.907MiB 0.000B
Sqlite (gzip) 766.293KiB 766.354KiB -62.000B

Copy link

codspeed-hq bot commented Nov 22, 2024

CodSpeed Performance Report

Merging #5052 will not alter performance

Comparing feat/ga-fullTextIndex (f413ba4) with main (5e70d19)

Summary

✅ 11 untouched benchmarks

Copy link
Member

@aqrln aqrln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, one comment/question and a few missing snapshot updates that are currently failing on CI, and we're good to merge.

}

impl Client {
pub async fn connect(connection_str: &str, preview_features: BitFlags<PreviewFeature>) -> ConnectorResult<Client> {
pub async fn connect(connection_str: &str, _preview_features: BitFlags<PreviewFeature>) -> ConnectorResult<Client> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove the parameter as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend to leave it here. Both the mongodb-schema-connector and the sql-schema-connector rely on preview features, and we'll likely need this again in the future. Removing this preview_features parameter (and its propagated calls) to add it again in the future just adds noise, imho.

@jkomyno
Copy link
Contributor Author

jkomyno commented Nov 25, 2024

Looks great, one comment/question and a few missing snapshot updates that are currently failing on CI, and we're good to merge.

All snapshots pass since f413ba4

Copy link
Member

@aqrln aqrln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@jkomyno jkomyno merged commit 06d4b2f into main Nov 25, 2024
367 checks passed
@jkomyno jkomyno deleted the feat/ga-fullTextIndex branch November 25, 2024 17:30
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.

2 participants