All Projects → dlevsha → Compalex

dlevsha / Compalex

Lightweight script to compare two database

Projects that are alternatives of or similar to Compalex

Erd
A Rails engine for drawing your app's ER diagram
Stars: ✭ 296 (-6.92%)
Mutual labels:  database-schema, database-management, database-migrations
Obevo
Obevo is a database deployment tool that handles enterprise scale schemas and complexity
Stars: ✭ 192 (-39.62%)
Mutual labels:  database-schema, database-management, database-migrations
upscheme
Database migrations and schema updates made easy
Stars: ✭ 737 (+131.76%)
Mutual labels:  database-migrations, database-management, database-schema
cl-migratum
Database Schema Migration System for Common Lisp
Stars: ✭ 29 (-90.88%)
Mutual labels:  database-migrations, database-management, database-schema
Prana
Golang Database Management and Code Generation
Stars: ✭ 89 (-72.01%)
Mutual labels:  database-management, database-migrations
mongo-migrate
Versioned migrations for MongoDB.
Stars: ✭ 79 (-75.16%)
Mutual labels:  database-migrations, database-management
Liquibase
Main Liquibase Source
Stars: ✭ 2,910 (+815.09%)
Mutual labels:  database-management, database-migrations
Sql Database Management System
SQL is a domain-specific language used in programming and designed for managing data held in a relational database management system, or for stream processing in a relational data stream management system.
Stars: ✭ 83 (-73.9%)
Mutual labels:  database-schema, database-management
Express Knex Objection
A simple API system on a pg database, using knex and objection to simplify connection and management
Stars: ✭ 20 (-93.71%)
Mutual labels:  database-schema, database-migrations
Migrate
Issues for Prisma Migrate are now tracked at prisma/prisma. This repo was used to track issues for Prisma Migrate Experimental and is now deprecated.
Stars: ✭ 780 (+145.28%)
Mutual labels:  database-schema, database-migrations
Schemahero
A Kubernetes operator for declarative database schema management (gitops for database schemas)
Stars: ✭ 265 (-16.67%)
Mutual labels:  database-schema, database-management
r2dbc-migrate
R2DBC database migration tool & library
Stars: ✭ 83 (-73.9%)
Mutual labels:  database-migrations, database-management
Dbmate
🚀 A lightweight, framework-agnostic database migration tool.
Stars: ✭ 2,228 (+600.63%)
Mutual labels:  database-schema, database-migrations
maricutodb
PHP Flat File Database Manager
Stars: ✭ 23 (-92.77%)
Mutual labels:  database-management, database-schema
Clinic-Management-System-ASP.NET
👨‍⚕️ A fully featured Clinic Management System based on three tier architecture made using ASP.NET, C# with a well documented README.md file.
Stars: ✭ 82 (-74.21%)
Mutual labels:  database-management, database-schema
core
Declarative database schema definition
Stars: ✭ 31 (-90.25%)
Mutual labels:  database-schema
mathesar
Web application providing an intuitive user experience to databases.
Stars: ✭ 95 (-70.13%)
Mutual labels:  database-management
Pg chameleon
MySQL to PostgreSQL replica system
Stars: ✭ 274 (-13.84%)
Mutual labels:  database-migrations
cdbt
Custom DataBase Tables plugin is for WordPress
Stars: ✭ 24 (-92.45%)
Mutual labels:  database-management
sap-hana-driver-for-sqltools
A Visual Studio Code extension which extends the SQLTools extension, with a driver to work with the SAP HANA Database. It supports tables and views, as well as running queries on an SAP HANA Database.
Stars: ✭ 17 (-94.65%)
Mutual labels:  database-management

README

What is Compalex?

Compalex is a lightweight script to compare two database schemas. It supports MySQL, MS SQL Server and PostgreSQL.

Try demo or visit http://compalex.net/

How to use

The easiest way to use Compalex is to use Docker.

You can build your own container using Dockerfile or use Docker Hub image:

docker run -it -e DATABASE_DRIVER='mysql' \
-e DATABASE_ENCODING='utf8' \
-e SAMPLE_DATA_LENGTH='100' \
-e DATABASE_HOST='host.docker.internal' \
-e DATABASE_PORT='3306' \
-e DATABASE_NAME='compalex_dev' \
-e DATABASE_USER='root' \
-e DATABASE_PASSWORD='password' \
-e DATABASE_DESCRIPTION='Developer database' \
-e DATABASE_HOST_SECONDARY='host.docker.internal' \
-e DATABASE_PORT_SECONDARY='3306' \
-e DATABASE_NAME_SECONDARY='compalex_prod' \
-e DATABASE_USER_SECONDARY='root' \
-e DATABASE_PASSWORD_SECONDARY='password' \
-e DATABASE_DESCRIPTION_SECONDARY='Production database' \
-p 8000:8000 dlevsha/compalex

You need to change variables for your own

DATABASE_DRIVER - database driver, possible value

  • mysql - for MySQL database
  • pgsql - for PostgreSQL database
  • dblib - for Microsoft SQL Server database
  • oci - for Oracle database

DATABASE_HOST and DATABASE_HOST_SECONDARY - database host name or IP for first and second server

If your compared DB run locally:

  • for MacOS and Windows user: use host.docker.internal instead of localhost in DATABASE_HOST and DATABASE_HOST_SECONDARY param. Because we run script inside container we need to use Host machine IP for connection.

  • for Linux user: use --network host option and localhost in DATABASE_HOST and DATABASE_HOST_SECONDARY param.

If you connect to DB outside your machine (external IP) use: -e DATABASE_HOST='[Your external IP]'.

DATABASE_PORT and DATABASE_PORT_SECONDARY - database port for first and second server

Default ports for DB:

  • 3306 - Mysql
  • 5432 - PostgreSQL
  • 1433 - MSSQL
  • 1521 - Oracle

DATABASE_NAME and DATABASE_NAME_SECONDARY - first and second database name

DATABASE_USER / DATABASE_PASSWORD and DATABASE_USER_SECONDARY / DATABASE_PASSWORD_SECONDARY - login and password to access your databases

DATABASE_DESCRIPTION and DATABASE_DESCRIPTION_SECONDARY - server description (not necessary). For information only. These names will display as a database name.

You can also use docker-compose.yml.

version: "3.7"

services:
  compalex:
    image: dlevsha/compalex
    container_name: compalex
    environment:
      - DATABASE_DRIVER=mysql
      - DATABASE_ENCODING=utf8
      - SAMPLE_DATA_LENGTH=100
      - DATABASE_HOST=host.docker.internal
      - DATABASE_PORT=3306
      - DATABASE_NAME=compalex_dev
      - DATABASE_USER=root
      - DATABASE_PASSWORD=password
      - DATABASE_DESCRIPTION=Developer database
      - DATABASE_HOST_SECONDARY=host.docker.internal
      - DATABASE_PORT_SECONDARY=3306
      - DATABASE_NAME_SECONDARY=compalex_prod
      - DATABASE_USER_SECONDARY=root
      - DATABASE_PASSWORD_SECONDARY=password
      - DATABASE_DESCRIPTION_SECONDARY=Production database
    ports:
      - "8000:8000"

Requirements

If you prefer use Compalex as PHP script please read instruction bellow.

Compalex is only supported by PHP 5.4 and up with PDO extension.

Installation

$ git clone https://github.com/dlevsha/compalex.git
$ cd compalex

Open .environment. You'll see configuration params

[ Main settings ]
; Possible DATABASE_DRIVER: 'mysql', 'pgsql', 'dblib', 'oci'.
; Please use 'dblib' for Microsoft SQL Server
DATABASE_DRIVER = mysql
DATABASE_ENCODING = utf8
SAMPLE_DATA_LENGTH = 100

[ Primary connection params ]
DATABASE_HOST = localhost
DATABASE_PORT = 3306
DATABASE_NAME = compalex_dev
DATABASE_USER = root
DATABASE_PASSWORD =
DATABASE_DESCRIPTION = Developer database

[ Secondary connection params ]
DATABASE_HOST_SECONDARY = localhost
DATABASE_PORT_SECONDARY = 3306
DATABASE_NAME_SECONDARY = compalex_prod
DATABASE_USER_SECONDARY = root
DATABASE_PASSWORD_SECONDARY =
DATABASE_DESCRIPTION_SECONDARY = Production database

where

DATABASE_DRIVER - database driver, possible value

  • mysql - for MySQL database
  • pgsql - for PostgreSQL database
  • dblib - for Microsoft SQL Server database
  • oci - for Oracle database

[ Primary connection params ] and [ Secondary connection params ]sections describes settings for first and second databases.

Where

DATABASE_HOST and DATABASE_HOST_SECONDARY - database host name or IP for first and second server

DATABASE_PORT and DATABASE_PORT_SECONDARY - database port for first and second server

Default ports:

  • 3306 - Mysql
  • 5432 - PostgreSQL
  • 1433 - MSSQL
  • 1521 - Oracle

DATABASE_NAME and DATABASE_NAME_SECONDARY - first and second database name

DATABASE_USER / DATABASE_PASSWORD and DATABASE_USER_SECONDARY / DATABASE_PASSWORD_SECONDARY - login and password to access your databases

DATABASE_DESCRIPTION and DATABASE_DESCRIPTION_SECONDARY - server description (not necessary). For information only. These names will display as a database name.

Inside compalex directory run

$ php -S localhost:8000

Now open your browser and type http://localhost:8000/

You'll see database schema of two compared databases.

Database Compare Panel

You can run this script in terminal (for example, if you don't have direct connection to database).

I recommend eLinks (free text-based console web browser) because it supports HTML-formatting and colors.

Install the script and run web-server as described above on your server.

Then run:

$ elinks http://localhost:8000

You'll see database schema in your terminal

Database schema in terminal

Sometimes you have only SSH access to remote database server and you can't open port for external connections. In this case you can use port forwarding via SSH

ssh -L 1522:localhost:1521 [user name]@[remote host 1]
ssh -L 1523:localhost:1521 [user name]@[remote host 2]

This command will forward 1521 port from remote servers to local 1522 and 1523 respectively.

LICENSE

Copyright (c) 2021, Levsha Dmitry

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].