Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

No cross schema generation using cli #2430

Open
Shemnei opened this issue Nov 29, 2024 · 0 comments
Open

No cross schema generation using cli #2430

Shemnei opened this issue Nov 29, 2024 · 0 comments

Comments

@Shemnei
Copy link

Shemnei commented Nov 29, 2024

Description

Trying to generate entities of one schema fails if a table references (anything?) a enum from another schema.
I am not quite sure if this is a bug or a limitation of the cli as it only allows to define/provide a single schema per generation run.

On a site not, the created enum is also not generated.

Steps to Reproduce

  1. Create a schema x with a single enum within
CREATE SCHEMA "x";
CREATE TYPE "x"."my_enum" AS ENUM('A', 'B', 'C');
  1. Create new schema called y with table referencing this enum
CREATE SCHEMA "y";
CREATE TABLE IF NOT EXISTS "y"."my_table" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"my_enum_value" "x"."my_enum"
);
  1. Try to generate entities
sea-orm-cli generate entity \
	--verbose \
	--output-dir src/db/schema/x \
	--with-serde=both \
	--date-time-crate=chrono \
	--database-schema=x

sea-orm-cli generate entity \
	--verbose \
	--output-dir src/db/schema/y \
	--with-serde=both \
	--date-time-crate=chrono \
	--database-schema=y

Expected Behavior

The generation to succeed.

Actual Behavior

Aborts with error: error returned from database: type "XXX" does not exist

Reproduces How Often

100%

Workarounds

None really - Move all entities into a single schema?

Reproducible Example

Versions

sea-orm-cli: 1.1.1
database: postgres

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant