sea-schema icon indicating copy to clipboard operation
sea-schema copied to clipboard

Error generating entity fromSQLite database with decimal type

Open cxgreat2014 opened this issue 5 months ago • 0 comments

Description

I encountered an issue while attempting to generate an entity from a Django site's SQLite database using the sea-orm-cli. It seems to fail when dealing with the decimal type.

Steps to Reproduce

  1. Create a SQLite table as follows:
CREATE TABLE django_apscheduler_djangojobexecution
(
    id        INTEGER      NOT NULL PRIMARY KEY AUTOINCREMENT,
    status    VARCHAR(50)  NOT NULL,
    run_time  DATETIME     NOT NULL,
    duration  DECIMAL,
    finished  DECIMAL,
    exception VARCHAR(1000),
    traceback TEXT,
    job_id    VARCHAR(255) NOT NULL,
    CONSTRAINT unique_job_executions UNIQUE (job_id, run_time)
);
  1. Execute sea-orm-cli generate entity -v
2024-01-30T11:15:00.907209Z DEBUG sqlx::query: summary="PRAGMA foreign_key_list('django_apscheduler_djangojobexecution')" db.statement="" rows_affected=0 rows_returned=1 elapsed=70.6µs
2024-01-30T11:15:00.907468Z DEBUG sqlx::query: summary="PRAGMA table_info('django_apscheduler_djangojobexecution')" db.statement="" rows_affected=0 rows_returned=8 elapsed=97.6µ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

Error occurs at sea-schema/types.rs:62.

Expected Behavior

Actual Behavior

Reproduces How Often

Always reproducible.

Versions

  • sea-orm-cli: 0.12.12

Additional Information

cxgreat2014 avatar Jan 30 '24 15:01 cxgreat2014