ponder-lab / Imperative-DL-Study-Web-App

0 stars 0 forks source link

Migrations are not being applied to the dev server #166

Closed ZhongweiL closed 2 years ago

ZhongweiL commented 2 years ago

There were no migrations to apply according to the most recent release log on Heroku.

khatchad commented 2 years ago

But, no migrations are running at all. In fact, the log says that we need to make migrations. Is it expected that no migrations are run when there is a deployment?

ZhongweiL commented 2 years ago

I'm not sure if this is how it's supposed to work. But I think it makes sense to run the same migration file only the first time because there is no reason to apply the same changes more than once.

khatchad commented 2 years ago

I agree, but I don't know why it thinks there are no migrations at all. If that was the case, I would expect a different error message saying that there are no updates. Please investigate.

ZhongweiL commented 2 years ago

From this post, I think that Django keeps a history of all the migrations that have been run. So No migration to apply would mean there is no unapplied migration.

khatchad commented 2 years ago

Is " No migration to apply" the message we should be getting? Is that a real message?

ZhongweiL commented 2 years ago

That should be the message we get when there is no unapplied migration. I'm not sure what you mean by real message.

khatchad commented 2 years ago

That should be the message we get when there is no unapplied migration.

According to who?

I'm not sure what you mean by real message.

Is it something you made up or did you see that in some documentation, for example?

khatchad commented 2 years ago

And, if it is a "real" message that we should be getting, why aren't we getting it?

ZhongweiL commented 2 years ago

I can't find the documentation for that message but it's what we usually get when we run migration with no unapplied migrations. And we're getting that message in the release log.

khatchad commented 2 years ago

I can't find the documentation for that message but it's what we usually get when we run migration with no unapplied migrations.

We do? I thought we got the message that says we need to make migrations.

And we're getting that message in the release log.

Where?

ZhongweiL commented 2 years ago

System check identified some issues: WARNINGS: ?: (debug_toolbar.staticfiles.W001) debug_toolbar requires the STATICFILES_DIRS directories to exist. HINT: Running manage.py collectstatic may help uncover the issue. ?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default' HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/3.2/ref/databases/#mysql-sql-mode Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions Running migrations: No migrations to apply. Your models in app(s): 'ponder' have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

khatchad commented 2 years ago

Does the merging of https://github.com/ponder-lab/Imperative-DL-Study-Web-App/pull/169 solve this issue?

khatchad commented 2 years ago

@mZneit, I thought you had done migrations ths semester? Why is there no initial migrations file for which @ZhongweiL can add schema altering migration files on top of? @ZhongweiL is trying to change some aspects of the scheme related to uniqueness. He should be able to do this through migrations, but there is no initial migration file. Are we still at the point where such changes must be made directly to the DB?

mZneit commented 2 years ago

I see the file was added again, so this should solve the problem (assuming there was a problem related to the file). But then it was removed?

ZhongweiL commented 2 years ago

I added a file called "0001_init.py", with the most recent changes included. But it was ignored by Django and I assumed it was because the file name already existed in the migration history. Then I removed that and added a migration file referencing "0001_init.py" as the dependency, but then Django says the dependency did not exist. Do you think adding "0001_init.py" back with the original schema and another migration file making changes and referencing it as a dependency would solve the problem?

mZneit commented 2 years ago

I added a file called "0001_init.py", with the most recent changes included. But it was ignored by Django and I assumed it was because the file name already existed in the migration history. Then I removed that and added a migration file referencing "0001_init.py" as the dependency, but then Django says the dependency did not exist. Do you think adding "0001_init.py" back with the original schema and another migration file making changes and referencing it as a dependency would solve the problem?

I'm not sure if I'm the one addressed in this question. I don't know if that would solve the problem but I think you should try this fix.

ZhongweiL commented 2 years ago

Looks like it worked. https://dashboard.heroku.com/apps/fathomless-inlet-57767/activity/releases/9c5ad9b9-d287-4008-8283-0a00d466d316

khatchad commented 2 years ago

Great. Is your problem solved now?

ZhongweiL commented 2 years ago

Yes

khatchad commented 2 years ago

@ZhongweiL. Can we close this?

ZhongweiL commented 2 years ago

Yes