Как указать сценарий базы данных инициализации для SQL Server через docker-compose
с помощью файла сценария SQL?
docker-compose.yml
database:
image: microsoft/mssql-server-linux:2017-latest
container_name: database
ports:
- 1433:1433
volumes:
- /var/opt/mssql
environment:
SA_PASSWORD: "P@55w0rd"
ACCEPT_EULA: "Y"
schema.sql
CREATE TABLE Department
(
Id INT PRIMARY KEY IDENTITY (1, 1),
Name VARCHAR (50) NOT NULL
);
CREATE TABLE Student
(
Id INT PRIMARY KEY IDENTITY (1, 1),
Name VARCHAR (50) NOT NULL
);
CREATE TABLE Course
(
Id INT PRIMARY KEY IDENTITY (1, 1),
Name VARCHAR (50) NOT NULL
);
INSERT INTO Student (Id, Name) VALUES(1, "John Doe");
INSERT INTO Student (Id, Name) VALUES(2, "Jane Doe");