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

Is there any way I can control the installed driver of database ? #44

Open
paudelgaurav opened this issue May 6, 2024 · 7 comments
Open

Comments

@paudelgaurav
Copy link

I am using mysql as database but drivers of other databases are also installed.

@giautm
Copy link
Member

giautm commented May 25, 2024

Hello, can you please explain more detail about your case?

@paudelgaurav
Copy link
Author

paudelgaurav commented Jun 4, 2024

@giautm
Thank you for your response.

As you can see, below is my atlas.hcl file

data "external_schema" "gorm" {
  program = [
    "go",
    "run",
    "-mod=mod",
    "ariga.io/atlas-provider-gorm",
    "load",
    "--path", "./models",
    "--dialect", "mysql",
  ]
}

env "gorm" {
  src = data.external_schema.gorm.url
  dev = "docker://mysql/8/dev"
  migration {
    dir = "file://migrations"
  }
  format {
    migrate {
      diff = "{{ sql . \"  \" }}"
    }
  }
}

I am using MySQL as my database, but my go.sum file contains dependencies related to PostgreSQL and SQLite. My main concern is the maintainability of these unnecessary dependencies.

gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8=
gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
gorm.io/driver/postgres v1.5.2 h1:ytTDxxEv+MplXOfFe3Lzm7SjG09fcdb3Z/c056DTBx0=
gorm.io/driver/postgres v1.5.2/go.mod h1:fmpX0m2I1PKuR7mKZiEluwrP3hbs+ps7JIGMUBpCgl8=
gorm.io/driver/sqlite v1.5.2 h1:TpQ+/dqCY4uCigCFyrfnrJnrW9zjpelWVoEVNy5qJkc=

@luantranminh
Copy link
Collaborator

Hi @paudelgaurav,
Those drivers are used internally by our implementation. We decided to let users choose a driver by specifying a string for the driver's name (e.g., mysql, postgres, sqlite ...) instead of including the entire driver at the initial stage. As a result, all drivers need to be added as dependencies.

There is indeed an impact on maintainability since you don't have control over the driver version being used. However, we're actively maintaining and developing the project, and any contributions are welcome.

@paudelgaurav
Copy link
Author

@luantranminh Thank you for your answer. I will close this issue now.

@giautm giautm reopened this Jun 12, 2024
@giautm
Copy link
Member

giautm commented Jun 12, 2024

Hey, please keep the issue open. I think we can make improvement in future.

@macmacbr
Copy link

macmacbr commented Jul 2, 2024

+1 on keeping this open.
Using this project brings a lot of extra dependencies that are unnecessary to our internal project.
E.g. The current sqlite3 driver used by this project has vulnerabilities and need upgrade. In our case, it holds back our PRs for something we are not even using.
It also adds unnecessary licenses (from the drivers) that impose extra huddles in maintaining internal applications.
This is a great project and I believe this feature adds to its adoption/maintainability.

@luenge
Copy link

luenge commented Oct 3, 2024

Including the sqlite driver causes problems with alpine images
go-gorm/sqlite#177

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

No branches or pull requests

5 participants