Register for your free account! | Forgot your password?

You last visited: Today at 02:48

  • 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
 
elite*gold: 0
Join Date: Jul 2009
Posts: 642
Received Thanks: 238
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, 4 views)



pintinho12 is offline  
Thanks
1 User
Old 01/30/2020, 00:24   #2
 
elite*gold: 12
Join Date: Jul 2011
Posts: 7,610
Received Thanks: 3,746
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
 
elite*gold: 0
Join Date: Oct 2007
Posts: 1,554
Received Thanks: 615
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
 
elite*gold: 0
Join Date: Jul 2009
Posts: 642
Received Thanks: 238
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
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,744
Received Thanks: 928
What's up with the variable names?
Super Aids is offline  
Old 01/30/2020, 04:47   #6
 
elite*gold: 0
Join Date: Jul 2008
Posts: 25
Received Thanks: 1
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.
Virus7799 is offline  
Old 01/30/2020, 09:05   #7
Moderator

 
elite*gold: 0
Join Date: Jul 2006
Posts: 2,174
Received Thanks: 767
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
 
elite*gold: 0
Join Date: Jul 2009
Posts: 642
Received Thanks: 238
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



« [Release] Project Phoenix (Patch 5187) | [Releases]Source Veterans 5165 Classic ! »

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 02:48.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

BTC: 33E6kMtxYa7dApCFzrS3Jb7U3NrVvo8nsK
ETH: 0xc6ec801B7563A4376751F33b0573308aDa611E05

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