/db-writer-mssql

SQL Server Database Writer

Primary LanguagePHPMIT LicenseMIT

Microsoft SQL Server DB Writer

Docker Repository on Quay Build Status Code Climate Test Coverage License

Writes data to Microsoft SQL Server Database.

When connecting to an Azure database and using SSH tunnel, the username must be in format <username>@<databasename> instead of just <username> otherwise it will throw errors.

Example configuration

    {
      "db": {        
        "host": "HOST",
        "port": "PORT",
        "database": "DATABASE",
        "user": "USERNAME",
        "password": "PASSWORD",
        "ssh": {
          "enabled": true,
          "keys": {
            "private": "ENCRYPTED_PRIVATE_SSH_KEY",
            "public": "PUBLIC_SSH_KEY"
          },
          "sshHost": "PROXY_HOSTNAME"
        }
      },
      "tables": [
        {
          "tableId": "simple",
          "dbName": "dbo.simple",
          "export": true, 
          "incremental": true,
          "primaryKey": ["id"],
          "items": [
            {
              "name": "id",
              "dbName": "id",
              "type": "int",
              "size": null,
              "nullable": null,
              "default": null
            },
            {
              "name": "name",
              "dbName": "name",
              "type": "nvarchar",
              "size": 255,
              "nullable": null,
              "default": null
            },
            {
              "name": "glasses",
              "dbName": "glasses",
              "type": "nvarchar",
              "size": 255,
              "nullable": null,
              "default": null
            }
          ]                                
        }
      ]
    }

Development

  1. Install dependencies

     docker-compose run --rm dev composer install
    
  2. Write some code and run tests in dev mode to see what you did:

     docker-compose run --rm dev composer ci