Since you have source table, you can check "inspectdb" command to
generate model for that table.

Try using the generated model into new migration.

Hope this helps.

On Fri, Aug 12, 2022 at 7:48 PM Stu.Axon <[email protected]> wrote:

> Are you suggesting I should have my code generate the file with the data
> migration in it manually ?
>
> I was thinking there might be some signal or something I could raise that
> would tell django a migration was required.
>
> The I was thinking thinking I could hook into makemigrations to and
> generate the data migration there somehow.
>
> On Friday, August 12, 2022 at 2:42:45 PM UTC+1 [email protected] wrote:
>
>> Django data migration can help in your case.
>>
>> https://docs.djangoproject.com/en/4.1/topics/migrations/#data-migrations
>>
>> 1. add empty migration
>> 2. add your data manipulation logic there.
>>
>>
>> On Fri, Aug 12, 2022 at 3:12 AM M Adnan <[email protected]> wrote:
>>
>>> When we create a modal or change a modal than we use these two commands
>>> python manage.py makemigrations here our table are created and to insert
>>> these table into database this command is necessary python manage.py
>>> migrate. I hope you will understand this.
>>>
>>> On Fri, 12 Aug 2022, 12:56 am Stu.Axon, <[email protected]> wrote:
>>>
>>>> I've got a table that has a list of classnames (that aren't models)
>>>> that are subclasses of a class.
>>>>
>>>> I'd like to hook into makemigrations and generate data migrations to
>>>> add / remove data as required - any idea the best way I can do this ?
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/765737bd-2139-45ef-a6ed-6eb802d58f6cn%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/765737bd-2139-45ef-a6ed-6eb802d58f6cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CABNyTSrTO3twOvr%3D4JiKiJJt-tOQxqcC%2BwCz3y9dTLKDs9YWgw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CABNyTSrTO3twOvr%3D4JiKiJJt-tOQxqcC%2BwCz3y9dTLKDs9YWgw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> Thanks & Regards,
>>
>> *Durai pandianEmail    : [email protected] *
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/40032aee-f3f4-478c-8cc2-89eccdc26b4bn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/40032aee-f3f4-478c-8cc2-89eccdc26b4bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Thanks & Regards,

*Durai pandianEmail    : [email protected] <[email protected]> *

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJsc%2BoYGvh%3Dahz39Q%3D-toE%2BY3LaRt8U%2BQpfWf5XeOxop6ctyQg%40mail.gmail.com.

Reply via email to