sqlboiler icon indicating copy to clipboard operation
sqlboiler copied to clipboard

Problem parsing a table with camel case: aluguelVagas

Open robertobelli opened this issue 3 years ago • 1 comments

version used 4.13

The following table gives a error, and I can't make the alias found the table.

CREATE TABLE public."aluguelVagas" (
	id int8 NOT NULL DEFAULT nextvaleven('aluguelVagas'::text, 'id'::text),
	"idVaga" int8 NOT NULL,
	"idUnidadeNova" int8 NOT NULL,
	aprovada bool NOT NULL,
	"idMorador" int8 NULL,
	"idUsuario" int8 NULL,
	validade int8 NULL,
	validade_original int8 NULL,
	aplicada bool NULL,
	CONSTRAINT "aluguelVagas_pkey" PRIMARY KEY (id),
	CONSTRAINT "aluguelVagas_idUnidadeNova_fkey" FOREIGN KEY ("idUnidadeNova") REFERENCES public.unidades(id) ON DELETE CASCADE,
	CONSTRAINT "aluguelVagas_idVaga_fkey" FOREIGN KEY ("idVaga") REFERENCES public.vagas(id) ON DELETE CASCADE
);

When running the sqlboiler ==> He uses for the struct the name AluguelVagas, and for the funcion the same name. I expected the structure be named AluguelVaga

I create an alias but did not change anything:

[psql]
dbname = "fc_sync"
schema = "public"
host = "127.0.0.1"
user = "first"
pass = "first"

[aliases.tables.aluguelVagas]
up_plural     = "AluguelVagas"
up_singular   = "AluguelVaga"
down_plural   = "aluguelVagas"
down_singular = "aluguelVaga"

The error received when compiled:

models/aluguelVagas.go:813:6: AluguelVagas redeclared in this block
models/aluguelVagas.go:26:6: other declaration of AluguelVagas

The file bellow is the go generated file, I change to TXT to attach here. aluguelVagas.txt

robertobelli avatar Sep 29 '22 20:09 robertobelli

I'll tag it as a bug and look into it in the next weeks.

stephenafamo avatar Oct 02 '22 15:10 stephenafamo