Changes between Initial Version and Version 1 of Ticket #34877


Ignore:
Timestamp:
Sep 27, 2023, 2:14:35 PM (12 months ago)
Author:
Paolo Melchiorre
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #34877 – Description

    initial v1  
    1 Trying to get SQL code for a migrations I receive a `KeyEorr`
     1Trying to get SQL code for a migration I receive a `KeyError`.
    22
    33**Model**
     4
     5Example of a model with a `GenratedField`.
    46
    57{{{#!python
     
    2022**Step**
    2123
     24Generate the migration file:
     25
    2226{{{#!bash
    2327$ python -m manage makemigrations
     28}}}
     29
     30Steps to generate the error:
     31
     32{{{#!bash
    2433$ python -m manage sqlmigrate shop 0001
     34}}}
     35
     36Similar error with another command:
     37
     38{{{#!bash
     39$ python -m manage migrate shop 0001
    2540}}}
    2641
     
    7893}}}
    7994
     95**Expected result**
     96
     97{{{#!sql
     98BEGIN;
     99--
     100-- Create model Item
     101--
     102CREATE TABLE "shop_item" (
     103    "id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
     104    "price" numeric(7, 2) NOT NULL,
     105    "vat_price" numeric(8, 2) GENERATED ALWAYS AS (ROUND(("price" * 1.22), 2)) STORED
     106);
     107COMMIT;
     108}}}
Back to Top