Skip to content

Does not create database #4

Open

Description

@sinnbeck

I dont know if this is a feature request, or a bug.

When I add the mssql service, it does not seem to come with a database

services:
  mssql:
    type: mssql
    portforward: 1434

If I start it up and connect to it with the default username and password I only see the 3 default database. I would assume that it would add a database named database
image

Activity

  1. sinnbeck commented on Apr 6, 2022

    @sinnbeck
    Author

    I managed to get it working using 2 extra files and a few changed to the service. I added a folder I could map with the files needed .lando/mssql

    configure-db.sh

    #!/bin/bash
    
    /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $SA_PASSWORD -d master -i /mssql/setup.sql

    setup.sql

    CREATE DATABASE $(MSSQL_DB);

    And in .lando.yml

    services:
      mssql:
        type: mssql
        portforward: 1434
        run_as_root:
          - /mssql/configure-db.sh
        overrides:
          volumes:
            - ./.lando/mssql:/mssql
          environment:
            MSSQL_DB: "my_database"
    
  2. reynoldsalec commented on Oct 17, 2023

    @reynoldsalec
    SponsorMember

    @sinnbeck you're correct this service doesn't create a DB, was looking at it recently for an unrelated issue and it's pretty barebones...would be nice to have it create a database that can be specified through the creds option just like the MySQL and MariaDB services:

    services:
      mssql:
        type: mssql
        creds:
          database: mycooldb
          user: myuser
          password: mypassword
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions