Giter VIP home page Giter VIP logo

Comments (9)

vintprox avatar vintprox commented on May 20, 2024

Migrations is the good concept for MySQL+PHP stack

from onehourgamejam.

liambaloh avatar liambaloh commented on May 20, 2024

There is currently a folder of migration scripts located here: https://github.com/OneHourGameJam/OneHourGameJam/tree/master/SQL/migrations

But these must be executed manually and there isn't a good way to determine which ones you need to execute to get from the version you're on to the most recent one...

from onehourgamejam.

vintprox avatar vintprox commented on May 20, 2024

Really weird workaround would be to clear database, and then run those migrations in order every time. But we know how awful it is for performance and actual versioning.

You can require last migration number in config. If none, all migrations are gonna run (database then should be cleared before). When user runs upgrade script, it iterates through migration files to find bigger order number (than one specified in config) and builds queue.

from onehourgamejam.

liambaloh avatar liambaloh commented on May 20, 2024

The plan at the moment is to tie a migration file to a version, stored in config and compare it to a constant number somewhere in code. If the two don't match, migration scripts are ran. But that's not in the code yet, so you have to do it manually.

from onehourgamejam.

winniehell avatar winniehell commented on May 20, 2024

@liambaloh would using https://flywaydb.org/ be an option? It uses a structure similar to the one that already exists in the SQL directory here.

from onehourgamejam.

liambaloh avatar liambaloh commented on May 20, 2024

Eh, writing a database versioning script would take a few hours at most, probably not worth the annoyance of including another external dependency. It's just a version number and dictionary of database-version to sql query. If the version doesn't match the last entry in the list, find it and execute all SQL queries between it and the end, update the version number in the database once done.

I'd like to keep external dependencies to a minimum, at least until #55 is done (and yes, I've been really bad with ignoring #70 for a long time until it got out of date, It's on me and I'm sorry 😢)

from onehourgamejam.

winniehell avatar winniehell commented on May 20, 2024

I'd like to keep external dependencies to a minimum

My suggestion was probably too brief. 😃 I didn't intend to add flyway as a PHP dependency but use it as a command line tool. Not sure if that is feasible given that I don't need to admin this. 😉

It's just a version number and dictionary of database-version to sql query

This is basically what flyway does: https://flywaydb.org/getstarted/how

from onehourgamejam.

liambaloh avatar liambaloh commented on May 20, 2024

Ah okay! That makes it way more appealing. There are two concerns that came to mind though:

  • The first is just a general feeling that we'd be doing the database equivalent of using visual studio for something notepad could do, which isn't necessarily a bad thing, but it seems overkill to me... This concern can't really be taken away, so I won't dwell on it, but thought I'd mention it anyway.
  • The second is more of a technical problem: While the database structure could be migrated with this, we also use the config table to store key-value pairs, which would more commonly be implemented as an additional table with dozens of columns, with just one entry. We store the data as entries in a single table called configs though. So we'd need some data migration, but definitely not other data migration.

Anyway, the way I make the migration files at the moment is by looking through the SQL history in MySQL Workbench (though we use MariaDB)

image

from onehourgamejam.

Denneledoe avatar Denneledoe commented on May 20, 2024

yes. code. mhmm, PHP

from onehourgamejam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.