Package: wigeon
wigeonDB Migrations for the continuous developer.Why wigeon?Your applications are continuously delivered, why not your databases too?Like its namesake, wigeon is compact, portable, and easily able to fit itself into your
repos/actions/pipelines/etc. to complement the continuous patterns you worked so hard
to put into place.Does not use an ORM or require language specific migration syntax meaning anyone
who canSELECT *can automate and continuously integrate/deliver data goodness
to their apps/teams.Features includedDatabase package creationMigration manifest managementMigration build taggingConnection managerSimple connection definitions via environment variablesMigration changelog written to target databaseDeploy/run sql script migrationsDatabases supported (at the moment)sqlitemssqlserverDatabases to support (soon)postgresmysqlSetupDirect InstallpipinstallwigeonVia Docker-Composedocker-composeupAttach a shell to the wigeon_cli container. You can create packages/migrations and run them against
db services in the docker-compose network. Package files will write to your local compute using
volume mounts.You can edit environment variable names in your local manifest.json which will propigate to the cli service,
where the values for those variables are read. To change your target database, you will need to edit env
variables in the docker-compose file.To use:NOTE: prefix every command withpythonif you are running directly from a clone of the repo.Access help:wigeon--helpCreate package with nameflyforsqlitedbtype with local, dev, qa, and prod environments:wigeoncreatepackage--nameflytwo--dbtypesqlite--environmentslocal,dev,qa,prodCreate databases to connect to for each environment:sqlite3
.openfly-local.sqlite
.openfly-dev.sqlite
.openfly-qa.sqlite
.openfly-prod.sqlite(OPTIONAL) Set up environment variables and add to package manifest.json:exportLOCAL_CONNECTION_STRING=/home/usr/wigeon/fly-local.sqliteexportDEV_CONNECTION_STRING=/home/usr/wigeon/fly-dev.sqliteexportQA_CONNECTION_STRING=/home/usr/wigeon/fly-qa.sqliteexportPROD_CONNECTION_STRING=/home/usr/wigeon/fly-prod.sqlite(OPTIONAL) Config add env variable names for connectionstring of each environment in theflypackage:wigeonconfig--namefly--environmentlocal--conn_stringLOCAL_CONNECTION_STRING
wigeonconfig--namefly--environmentdev--conn_stringDEV_CONNECTION_STRING
wigeonconfig--namefly--environmentqa--conn_stringQA_CONNECTION_STRING
wigeonconfig--namefly--environmentprod--conn_stringPROD_CONNECTION_STRING(OPTIONAL) If running mssql in docker you might Set up environment variables and
add to package manifest.json:exportLOCAL_MSSQL_SERVER=0.0.0.0:1433# or 127.0.0.1exportLOCAL_MSSQL_DBNAME=tempdbexportLOCAL_MSSQL_USERNAME=saexportLOCAL_MSSQL_PASSWORD=SApass123(OPTIONAL) Config add env variable names for connectionstring of each environment in theflypackage:wigeonconfig--namefly--environmentlocal--serverLOCAL_MSSQL_SERVER--databaseLOCAL_MSSQL_DBNAME--usernameLOCAL_MSSQL_USERNAME--passwordLOCAL_MSSQL_PASSWORD(OPTIONAL) Add environment variable names directly to manifest.json:"environments":{"local":{"connectionstring":"LOCAL_CONNECTION_STRING","server":null,"database":null,"username":null,"password:":null},"dev":{"connectionstring":"DEV_CONNECTION_STRING","server":null,"database":null,"username":null,"password:":null},"qa":{"connectionstring":"QA_CONNECTION_STRING","server":null,"database":null,"username":null,"password:":null},"prod":{"connectionstring":"PROD_CONNECTION_STRING","server":null,"database":null,"username":null,"password:":null}}Add migrations to theflypackage with build tag of0.0.1:wigeoncreatemigration--nameinitialize_db--packagefly--build0.0.1
wigeoncreatemigration--nameadd_habitat_table--packagefly--build0.0.1
wigeoncreatemigration--nameadd_paths_table--packagefly--build0.0.1SCRIPT SOME SQL IN THOSE MIGRATION FILES!!!List all migrations for theflypackage:wigeonshow--namefly--migrationsRun connection test to theflypackage's local environment:wigeonmigrate--namefly--connect_test--environmentlocalRun migrations for theflypackage (a local sqlite connection):wigeonmigrate--namefly--conn_string=/path/to/exampledb.sqliteORIF package's manifest.json is configured appropriately for a "local" environmentwigeonmigrate--namefly--environmentlocalRequirements (ODBC future support)For gcc compiler on Ubuntusudoaptinstallbuild-essentialFor ODBC on Ubuntusudoapt-getinstalllibssl-devlibffi-devpython3-dev
sudoapt-getinstall-yunixodbc-devFor mssql-server ODBC on UbuntuDocs for installing sqlserver odbc drivers (not yet supported):https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15running testspython-mpytest--cov-reportterm-missing--cov=wigeontest/