← Back to context Comment by aynyc 2 months ago Any docs? Django migration is a HUUGE pain point for us. 2 comments aynyc Reply WesleyJohnson 2 months ago manage.py makemigrations myapp --empty --name add_some_view (in the migration file) operations=[migrations.RunSQL("Create View some_view AS ....", "DROP VIEW IF EXISTS...."] (in your models.py) class SomeView(models.Model): class Meta: db_table = 'some_view' managed = False manage.py makemigrations myapp --name add_some_view_model sgt 2 months ago An extremely common thing to do. Also great with materialized views. I bet it's documented somewhere in Django's docs.
WesleyJohnson 2 months ago manage.py makemigrations myapp --empty --name add_some_view (in the migration file) operations=[migrations.RunSQL("Create View some_view AS ....", "DROP VIEW IF EXISTS...."] (in your models.py) class SomeView(models.Model): class Meta: db_table = 'some_view' managed = False manage.py makemigrations myapp --name add_some_view_model sgt 2 months ago An extremely common thing to do. Also great with materialized views. I bet it's documented somewhere in Django's docs.
sgt 2 months ago An extremely common thing to do. Also great with materialized views. I bet it's documented somewhere in Django's docs.
(in the migration file)
(in your models.py)
An extremely common thing to do. Also great with materialized views. I bet it's documented somewhere in Django's docs.