-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
💾 Miis and the Pokemon were split into separate characters #7
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On top of modifying the Models/characters.sql, which is useful for initialisation of new databases (i.e. new dev setup), you should modify the generated migration's "Up" method to use "migrationBuilder.Sql()" to set the values for the column. This means that when the migration is run, the characters database table doesn't need to be truncated to have the release order values set.
@Sleeping-Dev this looks great and I'd like to accept but before I do, I wanna know a little more about what @skittlz444 is referring to. I usually never touch the migration files that
replacing the
to
When you do migrations like this, you usually have to wipe the database to scratch to add things. But does this prevent you from wiping the database over to make changes to your models? |
I believe what they meant was to do something along the lines of this:
so that when applying migrations, one wouldn't have to add the ReleaseOrder values manually. I'm thinking of solving this by just running an sql script ("addReleaseOrderValues.sql") that goes through each character entry and adds their respective ReleaseOrder value. It would look similar to "characters.sql", but of course just altering entries instead of adding new ones. In code it would look something like this:
For this to work in prod I believe we'd need to add addReleaseOrderValues.sql to the publish directory like this: In Smash_Combos.csproj: Otherwise it won't be copied when deploying, then migrations can't be applied, etc. etc. One drawback would be that this requires an additional .sql file to be added to prod. I could type the commands out by hand but that just... seems inefficient. On the other hand its just a one-time thing... Thoughts on this? Edit: Thinking about this more, I'll probably just type it out by hand. This really is a one time thing and adding an entire new file for just this migration feels very wrong. I'll check back in after work. |
@Sleeping-Dev is right with what I meant. Since it is a once off, it usually is best to type it out into the migrate up method rather than adding a new file. |
Alright, I'll write it up and commit after work 👍 |
I finished the update statements in the migration and am pretty much ready to commit. But when testing it I noticed that currently when setting up, it is still required to manually run I tested the migration by dropping and recreating the database, and as I forgot to run We could avoid this by automatically inserting the characters into the database during the AllTables-Migration I think? I don't think there's any problems with that, since I'm only adding Insert statements to an existing migration, right? That shouldn't impact databases that already have this migration applied, since those probably already have the data inserted anyway, so they're not missing out on any structural changes. |
I went ahead and tried it out and it worked, couldn't find any problems! Basically what I changed:
This probably could have been its own issue, but as I was editing migrations anyway I figured I'd just take care of it now, I'll split the commits up if necessary. Thoughts? |
@Sleeping-Dev Brilliant, I really like the changes to make running the characters sql obsolete. It all looks good, the only thing left to do is to update the contributions readme to reflect the changes of not needing to run characters sql anymore. Good work. |
Wow @Sleeping-Dev, I'm still learning what you're doing here but this is awesome great job! |
Thanks guys 👍 Ty @Breadkenty, if you have any questions I'll gladly help, just message me on discord! |
I split the Pokemon and the Miis up as specified in issue #4 each with their own graphic and went ahead and removed Pokemon Trainer as I don't think they'll be needed anymore now that the 'mons are separate. (The files are still there in case we want to realize @ejbee3 's idea of having the trainer clickable and then the 'mons selectable) I also added the ReleaseOrder to the Character Model, and updated characters.sql to include it for each char. I just gave Echo characters a half-step (eg. Peach = 13, Daisy = 13.5), so they'll always be sorted after their 'original'.
When called from the api, all characters are now sorted by their ReleaseOrder before being shown.
I apologize to @ejbee3 in case this gets accepted, you said you were working on this but I got excited as this is my first project as a contributer and spent the last couple hours on this 😅