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

It seems to ignore decimal places #21

Closed
joancostacosta opened this issue Jun 9, 2021 · 1 comment
Closed

It seems to ignore decimal places #21

joancostacosta opened this issue Jun 9, 2021 · 1 comment
Labels
invalid This doesn't seem right

Comments

@joancostacosta
Copy link

Processing this SQL:

CREATE TABLE IF NOT EXISTS "planidiet_app_valornormalperfil" (
"id" integer NOT NULL,
"quantitat" decimal(9, 5) NOT NULL,
"calories" decimal(9, 5) NOT NULL,
"element_id" integer NOT NULL,
"perfil_id" integer NOT NULL,
FOREIGN KEY("element_id") REFERENCES "planidiet_app_element"("id") DEFERRABLE INITIALLY DEFERRED,
FOREIGN KEY("perfil_id") REFERENCES "planidiet_app_perfil"("id") DEFERRABLE INITIALLY DEFERRED,
PRIMARY KEY("id" AUTOINCREMENT)
);

It creates that table in MySQL:

Table:planidiet_app_valornormalperfil
Columns:
id | int PK
quantitat | decimal(10,0)
calories | decimal(10,0)
element_id | int
perfil_id | int

Seems to ignore decimal digits!!

@techouse techouse added the bug Something isn't working label Jun 12, 2021
@techouse techouse added invalid This doesn't seem right and removed bug Something isn't working labels Jul 4, 2021
@techouse
Copy link
Owner

techouse commented Jul 4, 2021

Hey! I'm sorry but I simply can't reproduce this. I've even written a specific test for this and it passes normally.

I tried converting your SQLite DDL

CREATE TABLE "planidiet_app_valornormalperfil"
(
    "id"         integer       NOT NULL,
    "quantitat"  decimal(9, 5) NOT NULL,
    "calories"   decimal(9, 5) NOT NULL,
    "element_id" integer       NOT NULL,
    "perfil_id"  integer       NOT NULL,
    FOREIGN KEY ("element_id") REFERENCES "planidiet_app_element" ("id") DEFERRABLE INITIALLY DEFERRED,
    FOREIGN KEY ("perfil_id") REFERENCES "planidiet_app_perfil" ("id") DEFERRABLE INITIALLY DEFERRED,
    PRIMARY KEY ("id" AUTOINCREMENT)
);

and it got converted to

CREATE TABLE `planidiet_app_valornormalperfil` (
  `id` int NOT NULL,
  `quantitat` decimal(9,5) NOT NULL,
  `calories` decimal(9,5) NOT NULL,
  `element_id` int NOT NULL,
  `perfil_id` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci

@techouse techouse closed this as completed Jul 4, 2021
techouse added a commit that referenced this issue Jul 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants