Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not create database #4

Open
sinnbeck opened this issue Apr 6, 2022 · 2 comments
Open

Does not create database #4

sinnbeck opened this issue Apr 6, 2022 · 2 comments

Comments

@sinnbeck
Copy link

sinnbeck commented Apr 6, 2022

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

@sinnbeck
Copy link
Author

sinnbeck commented Apr 6, 2022

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"

@reynoldsalec
Copy link
Member

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants