In my project I use many tables such as table transaction_2021, transaction_2022, transaction_2023, and the same table will be created every time the year changes. Can this case be solved with 1 model, because I have searched for my problem and couldn’t find it.
Why you need to create separate tables for each year, you can simply add created_at field and then can filter queryset data with respective to year instead of creating a new table for each year.
I do this to be careful of damaged tables, and the hope is that if each year the data is separate so that each table has less data and the hope is that the next table will be accessed more quickly because it contains less data
If you’re using PostgreSQL, it natively supports partitioned tables. That’s what we use for this purpose.