redhat-beyond / JobSeeker

https://github.com/redhat-beyond/JobSeeker
MIT License
2 stars 5 forks source link

🐛 Feed: When Running `vagrant up`, A Migration File Gets Created #61

Closed taljacob2 closed 2 years ago

taljacob2 commented 2 years ago

@paOmer When I ran vagrant up, I got at the bottom of the output:

    default:   Your models in app(s): 'feed' have changes that are not yet reflected in a migration, and so won't be applied.
    default:   Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
    default: + setsid pipenv run python manage.py runserver 0.0.0.0:8000

So I ran:

pipenv run manage.py makemigrations feed

and a new file called feed/migrations/0012_alter_post_prefernces.py was created, according to the output:

Migrations for 'feed':
  feed/migrations/0012_alter_post_prefernces.py
    - Alter field prefernces on post

and the content of the feed/migrations/0012_alter_post_prefernces.py file is:

# Generated by Django 4.0.3 on 2022-03-30 06:32

from django.db import migrations, models
import django.db.models.deletion

class Migration(migrations.Migration):

    dependencies = [
        ('job_board', '0004_test_data_years_of_experiences'),
        ('feed', '0011_comments'),
    ]

    operations = [
        migrations.AlterField(
            model_name='post',
            name='prefernces',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='job_board.preference'),
        ),
    ]

Is this alright? Do you know this?

@taljacob2 thanks for letting me know.

That weird, Iv'e destroyed my VM and deleted the db file, the ran vagrant up but didn't got the output that you've got. Anyway I ran pipenv run python manage.py makemigrations and also got the same migration file as you did. I also ran pipenv run python manage.py migrate and everything seems to work find before and after this migration, I mean that I can see that the post model has the preference model linked to it via the admin panel before and after the migration.

I guess everything seems fine, and I'm wondering if this needs to be commited to repo, what are your thoughts about it?

I guess eventually we will add this file anyway because Django wants us to. Although I am not sure this file does anything essential. It is possible to decide about this in the future, and leave it like this for now.

Originally posted by @taljacob2 in https://github.com/redhat-beyond/JobSeeker/issues/27#issuecomment-1082965698