SeaQL / SeaQL/sea-orm

Entity Generation Fails to Skip Ignored Tables

Open
#2,089 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:cli Area:schema Sqlite
Dominant language
Rust
Stars
9.9k
Forks
734
Avg merge
6h 36m
Merged PRs (30d)
8

Description

Description

Encountering an issue (refer to GitHub issue #123), I aimed to exclude specific tables during entity generation. However, despite utilizing the --ignore-tables flag, the entity generation process failed without skipping the specified tables.

Steps to Reproduce

Execute the following command:

sea-orm-cli generate entity --ignore-tables django_apscheduler_djangojob,django_apscheduler_djangojobexecution -v

Check the log for details:

2024-01-30T15:32:35.334322Z DEBUG sqlx::query: PRAGMA foreign_key_list('django_apscheduler_djangojob') - elapsed=15.2µs
2024-01-30T15:32:35.334558Z DEBUG sqlx::query: PRAGMA table_info('django_apscheduler_djangojob') - elapsed=86.6µs
2024-01-30T15:32:35.334833Z DEBUG sqlx::query: PRAGMA index_list('django_apscheduler_djangojob') - elapsed=84.5µs
2024-01-30T15:32:35.335242Z DEBUG sqlx::query: SELECT ? FROM "sqlite_master" ... - elapsed=108.5µs
2024-01-30T15:32:35.335519Z DEBUG sqlx::query: PRAGMA foreign_key_list('django_apscheduler_djangojobexecution') - elapsed=80.1µs
2024-01-30T15:32:35.335822Z DEBUG sqlx::query: PRAGMA table_info('django_apscheduler_djangojobexecution') - elapsed=104.8µs
thread 'main' panicked at C:\Users\rustdev\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sea-schema-0.14.2\src\sqlite\def\types.rs:62:42:
index out of bounds: the len is 1 but the index is 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Expected Behavior
Actual Behavior
Reproduces How Often
Workarounds

Reproducible Example

Versions

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the sea-orm-cli generate entity entry point and reproduce the command using --ignore-tables against SQLite. Trace the failure reported in sea-schema-0.14.2/src/sqlite/def/types.rs and verify that ignored tables are skipped without the index-out-of-bounds panic; add or run a regression test if the relevant test location is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sqlite
Domain
cli, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.