MarriageMaster icon indicating copy to clipboard operation
MarriageMaster copied to clipboard

Add database type migration support

Open GeorgH93 opened this issue 6 years ago • 3 comments

Description:

It should be possible to migrate from SQLite to MySQL and from MySQL to SQLite.

GeorgH93 avatar Aug 05 '19 00:08 GeorgH93

Manual SQLite to MySQL migration:

  1. Change the Marriage Master config to use MySQL
  2. Start the server (to create the tables), but do not join or let anyone join
  3. Stop the server
  4. Download the sqlite tools for your os form the official website: https://sqlite.org/download.html
  5. Open the database file in the terminal/cmd (<path to sqlite3 executable> <path to db file>)
  6. Execute the following commands:
.mode insert
.output users.sql
select * from marry_players;
.output partners.sql
select * from marry_partners;
.output priests.sql
select * from marry_priests;
.output home.sql
select * from marry_home;
  1. Open the users.sql file in an editor and replace all " table " with " marry_players " (without the ")
  2. Open the partners.sql file in an editor and replace all " table " with " marry_partners " (without the ")
  3. Open the priests.sql file in an editor and replace all " table " with " marry_priests " (without the ")
  4. Open the home.sql file in an editor and replace all " table " with " marry_home " (without the ")
  5. You should now be able to import the sql files into your mysql database. Make sure that the players table is empty and all your servers are turned off before you start. While importing make sure to keep the order the following: users.sql, priests.sql, partners.sql, home.sql
  6. You should now be able to start your servers again and have all your data.

GeorgH93 avatar Jun 01 '21 18:06 GeorgH93

Manual SQLite to MySQL migration:

  1. Change the Marriage Master config to use MySQL
  2. Start the server (to create the tables), but do not join or let anyone join
  3. Stop the server
  4. Download the sqlite tools for your os form the official website: https://sqlite.org/download.html
  5. Open the database file in the terminal/cmd (<path to sqlite3 executable> <path to db file>)
  6. Execute the following commands:
.mode insert
.output users.sql
select * from marry_players;
.output partners.sql
select * from marry_partners;
.output priests.sql
select * from marry_priests;
.output home.sql
select * from marry_home;
  1. Open the users.sql file in an editor and replace all " table " with " marry_players " (without the ")
  2. Open the partners.sql file in an editor and replace all " table " with " marry_partners " (without the ")
  3. Open the priests.sql file in an editor and replace all " table " with " marry_priests " (without the ")
  4. Open the home.sql file in an editor and replace all " table " with " marry_home " (without the ")
  5. You should now be able to import the sql files into your mysql database. Make sure that the players table is empty and all your servers are turned off before you start. While importing make sure to keep the order the following: users.sql, priests.sql, partners.sql, home.sql
  6. You should now be able to start your servers again and have all your data.

i can't find all .sql i typed these command and i am stuck here plz help, thank you image

hkkongou avatar Jun 02 '21 07:06 hkkongou

The will be in the directory where you run the command from. In your case that would be C:\Users\Kelvin

GeorgH93 avatar Jun 02 '21 14:06 GeorgH93