Skip to content

andersonkrs/Laycan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laycan

An easy way to migrate the database schema from your application in C++/Qt.

How it works

Add a json file in the resources of your Qt application.

Laycan

Enter your first migration.

{
   "Migrations": [
       {
           "Description": "CREATE MY FIRST TABLE",
           "DownVersion": [
               "DROP TABLE USERS;"
           ],
           "UpVersion": [
               "CREATE TABLE "USERS" ",
               "(",
               "  "ID" serial NOT NULL, ",
               "  "NAME" character varying ",
               ")",
               "WITH (",
               "  OIDS=FALSE",
               ");",
               "ALTER TABLE "USERS" ",
               "  OWNER TO postgres;"
           ],
           "Version": "1"
       }
   ]
}

And simply migrate.

#include "laycan.h"

Laycan laycan;
bool ok = laycan.Migrate(":/MyMigrations.json"); //Your Migration File

if(!ok) {
  QMessageBox::critical(this, "An error occurred during migration", laycan.lastError());
}
It is ! Laycan will apply UpVersion SQL in the database and the version of the schema will go up version 0 (or a blank schema) to 1.

About

A database schema migration tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published