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

Duplicate generated models when using shared migrations #2071

Closed
Adibov opened this issue Feb 14, 2023 · 1 comment
Closed

Duplicate generated models when using shared migrations #2071

Adibov opened this issue Feb 14, 2023 · 1 comment
Labels
enhancement New feature or request question Further information is requested 🔧 golang

Comments

@Adibov
Copy link

Adibov commented Feb 14, 2023

Version

1.15.0

What happened?

In my project, I have multiple entities for my database and each of them has its own series of queries:
image

Also, all of them are using the same set of migrations since as I know, sqlc doesn't support migrating my database and is just generating queries, Therefor I need these migrations to be in the same place so I can manage them using another package (to be more precise, this package).

But the problem is that when I place the migrations in one place, a few are duplicated when trying to generate files. More formally, models.go and db.go files are duplicated and have same contents. Is there any solution to overcome this behavior?

Thanks in advance

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

version: "1"
packages:
  - name: "callers"
    path: "./entities/callers"
    queries: "./entities/callers/queries"
    schema: "./migrations"
    engine: "postgresql"
    emit_json_tags: false
    emit_interface: true

  - name: "conditions"
    path: "./entities/conditions"
    queries: "./entities/conditions/queries"
    schema: "./migrations"
    engine: "postgresql"
    emit_json_tags: false
    emit_interface: true

  - name: "eventsources"
    path: "./entities/eventsources"
    queries: "./entities/eventsources/queries"
    schema: "./migrations"
    engine: "postgresql"
    emit_json_tags: false
    emit_interface: true

  - name: "eventtargets"
    path: "./entities/eventtargets"
    queries: "./entities/eventtargets/queries"
    schema: "./migrations"
    engine: "postgresql"
    emit_json_tags: false
    emit_interface: true
  - name: "eventtargets"
    path: "./entities/eventtargets"
    queries: "./entities/eventtargets/queries"
    schema: "./migrations"
    engine: "postgresql"
    emit_json_tags: false
    emit_interface: true

  - name: "experiments"
    path: "./entities/experiments"
    queries: "./entities/experiments/queries"
    schema: "./migrations"
    engine: "postgresql"
    emit_json_tags: false
    emit_interface: true

  - name: "experimentselections"
    path: "./entities/experimentselections"
    queries: "./entities/experimentselections/queries"
    schema: "./migrations"
    engine: "postgresql"
    emit_json_tags: false
    emit_interface: true

  - name: "flags"
    path: "./entities/flags"
    queries: "./entities/flags/queries"
    schema: "./migrations"
    engine: "postgresql"
    emit_json_tags: false
    emit_interface: true

  - name: "layers"
    path: "./entities/layers"
    queries: "./entities/layers/queries"
    schema: "./migrations"
    engine: "postgresql"
    emit_json_tags: false
    emit_interface: true

  - name: "overrides"
    path: "./entities/overrides"
    queries: "./entities/overrides/queries"
    schema: "./migrations"
    engine: "postgresql"
    emit_json_tags: false
    emit_interface: true

  - name: "servicers"
    path: "./entities/servicers"
    queries: "./entities/servicers/queries"
    schema: "./migrations"
    engine: "postgresql"
    emit_json_tags: false
    emit_interface: true

  - name: "services"
    path: "./entities/services"
    queries: "./entities/services/queries"
    schema: "./migrations"
    engine: "postgresql"
    emit_json_tags: false
    emit_interface: true

overrides:
  - go_type: "github.com/jackc/pgtype.UUID"
    db_type: "uuid"

Playground URL

No response

What operating system are you using?

Linux

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

@Adibov Adibov added bug Something isn't working triage New issues that hasn't been reviewed labels Feb 14, 2023
@kyleconroy kyleconroy added enhancement New feature or request question Further information is requested 🔧 golang and removed bug Something isn't working triage New issues that hasn't been reviewed labels Feb 22, 2023
@kyleconroy
Copy link
Collaborator

Closing as a duplicate of #1941

@kyleconroy kyleconroy closed this as not planned Won't fix, can't repro, duplicate, stale Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested 🔧 golang
Projects
None yet
Development

No branches or pull requests

2 participants