Giter Site home page Giter Site logo

Use MySQL for `example/` is better. about bun HOT 8 CLOSED

uptrace avatar uptrace commented on August 18, 2024
Use MySQL for `example/` is better.

from bun.

Comments (8)

vmihailenco avatar vmihailenco commented on August 18, 2024 1

It would be much more useful to run tests on MySQL 5.7 instead of MySQL 8. Examples are not very representative.

from bun.

vmihailenco avatar vmihailenco commented on August 18, 2024 1

Yes, I think we need something like #50 (not tested)

from bun.

Codebreaker101 avatar Codebreaker101 commented on August 18, 2024

Examples use sqlite in-memory database that allows you to run the examples without the need for external database dependency. Additionally, since Bun works with any SQL database that has a go driver and dialect for it, only initialization is different between databases. And that could be as little as two lines of code.

- sqldb, err := sql.Open("sqlite3", ":memory:?cache=shared")
+ sqldb, err := sql.Open("mysql", "root:pass@/test")

- db := bun.NewDB(sqldb, sqlitedialect.New())
+ db := bun.NewDB(sqldb, mysqldialect.New())

There is no practical use here for using mysql database for examples.

from bun.

vmihailenco avatar vmihailenco commented on August 18, 2024

As @Codebreaker101 correctly guessed, SQLIte was chosen so you can run examples without configuring anything and/or running a Docker container. Also it seems more fair this way for PostgreSQL users :)

But the tests are run for all 3 supported databases - https://github.com/uptrace/bun/blob/master/internal/dbtest/db_test.go#L26-L73

from bun.

j2gg0s avatar j2gg0s commented on August 18, 2024

If bun want to be cross database and be widely used, MySQL and PostgreSQL is our must support.

Consider that, bun is migrated from go-pg, bun with PostgreSQL is good enough.
However, bun with MySQL (special 5.7) has many bugs.

So, write examples with MySQL brings more help.

from bun.

j2gg0s avatar j2gg0s commented on August 18, 2024

@vmihailenco do we have any plan to add MySQL 5.7 to internal/dbtest.

from bun.

j2gg0s avatar j2gg0s commented on August 18, 2024

i run internal/dbtest in my local env, mysql prior version 8.0:

  • does not support CTE
  • does not support where without from: SELECT 1 WHERE TRUE is syntax error.
  • notice system variable: explicit_defaults_for_timestamp
  • TIMESTAMP/DATETIME does not support time zone #48 , this block our usage with MySQL 5.7

from bun.

vmihailenco avatar vmihailenco commented on August 18, 2024

All should be fixed in master. Tests that use CTE are skipped on MySQL 5.

from bun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.