Register for your free account! | Forgot your password?

You last visited: Today at 09:59

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Simple database Migration manager

Discussion on Simple database Migration manager within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
pintinho12's Avatar
 
elite*gold: 0
Join Date: Jul 2009
Posts: 886
Received Thanks: 378
Talking Simple database Migration manager

Hello!

Today I've got a few free minutes at my work and coded something that I noticed that I need long time ago! There's room for improvements of course but this will be good for those who often updates their game database and also need to keep track of the changes. The script is simple and I'll be updating here as I upgrade my code on my source.


How to use:
  • Create a 'migrations' folder on your executable path
  • Put all your SQL Scripts in files inside of it
  • Files must have yyyyMMddHHmmss as the first 14 characters
  • Files must have from 16 to 128 characters
  • Before loading your mysql data just create a new instance of the MigrationManager and call .Migrate() method
  • Done!

Then, anything that you code on your test database, save the final code on a SQL file, name it 20200129183000 WhateverYouWant.sql and put in your production migrations folder! If the code hasn't been executed, your server will execute and you can keep track of the updates.

Ey! I'm sending your first migration sql file so you can test it! Good luck.

PS: don't forget to change the namespace!
Attached Files
File Type: zip 20200129182100_MyVeryFirstMigration.zip (400 Bytes, 13 views)
pintinho12 is offline  
Thanks
1 User
Old 01/30/2020, 00:24   #2
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,036
Received Thanks: 4,038
I see a lot of work went into this, so first thing's first, good job. But doesn't EF Core also allow you to track database migrations via command line?
Spirited is offline  
Thanks
1 User
Old 01/30/2020, 00:38   #3
 
turk55's Avatar
 
elite*gold: 130
Join Date: Oct 2007
Posts: 1,648
Received Thanks: 699
Quote:
Originally Posted by Spirited View Post
I see a lot of work went into this, so first thing's first, good job. But doesn't EF Core also allow you to track database migrations via command line?
dotnet ef migrations add [MigrationName]
turk55 is offline  
Thanks
1 User
Old 01/30/2020, 02:56   #4
 
pintinho12's Avatar
 
elite*gold: 0
Join Date: Jul 2009
Posts: 886
Received Thanks: 378
I know that I have a lot of things that I want to implement, but, I use Fluent NHibernate in my project and I don't want to depend on it to do everything. With files I have freedom to write SQL code as I wish.
But this will be updated as I find better pratices too. But for this I mostly just want to depend on MySQL standard library.
pintinho12 is offline  
Old 01/30/2020, 04:34   #5
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
What's up with the variable names?
Super Aids is offline  
Old 01/30/2020, 04:47   #6
 
elite*gold: 52
Join Date: Jul 2008
Posts: 46
Received Thanks: 13
Quote:
Originally Posted by Super Aids View Post
What's up with the variable names?
Looks like he's using an outdated naming convention, back when IDEs weren't as powerful especially with intellisense.



It's all personal preference in the end though.
Relic is offline  
Old 01/30/2020, 09:05   #7



 
KraHen's Avatar
 
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 793
I also don't see why the standard .NET migrations are not sufficient for this, but hey. Also, what's the reason behind fluent nhibernate? I'm a bit out of the loop with ORM stuff but IIRC it was really slow compared to the competition (I think it was Dapper maybe?)
KraHen is offline  
Old 01/30/2020, 18:31   #8
 
pintinho12's Avatar
 
elite*gold: 0
Join Date: Jul 2009
Posts: 886
Received Thanks: 378
Quote:
Originally Posted by KraHen View Post
I also don't see why the standard .NET migrations are not sufficient for this, but hey. Also, what's the reason behind fluent nhibernate? I'm a bit out of the loop with ORM stuff but IIRC it was really slow compared to the competition (I think it was Dapper maybe?)
If I start changing my server ORM now I will need to rewrite the entire server. Fluent NHibernate isn't slow at all, I never had performance issues with it, but since most servers out there doesn't use any ORM.
There's FluentMigrator but I don't want to use it. Also SchemaUpdate once droped all my tables and I got mad at it xD but of course it was my fault.
pintinho12 is offline  
Reply


Similar Threads Similar Threads
Careful "migration-scam" don't buy any WR-Accounts before migration.
06/16/2017 - WarRock - 5 Replies
The ongoing account migration to papaya can be used to get the account back after migration. Source: sirosix
Migration geht nicht! [Gamersfirst - Nexon]
06/25/2012 - WarRock - 18 Replies
Hey liebe Warrock-Community! Heute habe ich mal gedacht, ach komm spiele wieder eine runde Warrock nach ca. 2 Monaten Inaktivität. Nunja, ich wollte das Spiel starten, geht nicht. Klar Nexon hat übernommen! Stimmt! Gut dass ich damals schon zugestimmt habe. Naja denke ich mir und gehe auf die Homepage. Ich drückte auf Migration, dort soll man sich ganz einfach mit den Gamersfirst Daten anmelden. Okay, machte ich doch jedes mal erschien ein Fehler die Daten wären ungültig!! Ich versuchte es auf...
Any update for speed hack after migration ?
03/31/2011 - Atlantica Online - 0 Replies
Would be really apprciated.
Host Migration unterbrochen? (CoD7)
01/20/2011 - Call of Duty - 11 Replies
hi leute, ich habe ein problem wenn ich mit paar Kumpels privates match machen will klick ich mich ein. Dann lädt es, und dann nach 20sek kommt "verbindung zum host unterbrochen" ich bin der einzigste bei dem es nicht funktioniert bei den anderen 4 geht es... aber warum? PS. War bei MW2 auch so
migration , any vuluntier can help me pls ?
01/12/2011 - Archlord - 5 Replies
hi , so i have an account on tullan , but that server is dead , i am waiting from september till now for migrate to evenguarda but they dont make migrations anymore could a voluntier like dagus or someone pls tal k to gms so i can get my acc out of that dead server please ?



All times are GMT +2. The time now is 09:59.


Powered by vBulletin®
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2023 elitepvpers All Rights Reserved.