Hi Mike,

Thanks for your reply. To further clarify about `db_table` name regarding 
this vertical move. The 'db_table' field is actually already specified in 
the models. However, if the 'db_table' name were not specified in the model 
and let django handle generation table names, would this move break it?  
And it can be fixed by specifying the 'db_table" value in the moved models?

Thanks!

On Sunday, November 6, 2022 at 10:09:41 PM UTC-5 Mike Dewhirst wrote:

> On 7/11/2022 2:40 am, Nick Chang wrote:
>
> Hello community, 
>
> I am trying to organize my Django project's structure as the number of 
> apps is growing. So I am attempting to move an app in the sub-folder that 
> contains its model definitions. The app used to be named `<
> sub_folder_name>.foo <http://sub_folder_name%3E.foo/>` and now it will be 
> just named `foo` in the `LOCAL_APPS` setting.
>
> It seems straightforward to do this with the following two steps:
>
>    1. Change the reference from `<sub_folder_name>.foo 
>    <http://sub_folder_name%3E.foo/>` to `foo` in the whole project. 
>    2. Do `mv foo ..` inside the sub-folder. 
>
> Is there any DB migration work that this move requires? Or since the app 
> name stays the same. There is nothing that needs to be done as Django does 
> not see any change in the models. So far my investigation confirms no DB 
> migration work is needed but would like to hear some experiences that folks 
> might have done before.
>
>
> Should work just fine.
>
> In any case, you can also specify the table name the model should use if 
> you do decide to switch models between apps ...
>
>     class Meta:
>          app_label = "company"
>          db_table = "common_user"
>        
> If your python code works and your tests pass everything should be fine. 
>
>
>
> Thanks!
> -- 
> 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 django-users...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/5ac5eea7-f620-4d11-9796-3439231939f3n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/5ac5eea7-f620-4d11-9796-3439231939f3n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>
> -- 
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9f355cfa-12ed-4e4b-86a5-7c5ee4c348c3n%40googlegroups.com.

Reply via email to