yuniql
yuniql copied to clipboard
Use reserved directory _create for setting up new databases
When -a
or auto-create-db
is passed during yuniql run
, it will create an empty database using the default create database sql commands of the target platform. The command is typically like:
CREATE DATABASE helloyuniql;
This is not good enough when user needs special configuration of the database during creation such as specifying where the data files are, collation setup, partitions, file groups etc. To achieve this, we would need to execute SQL scripts stored on _create
directory. For example:
CREATE DATABASE Music
ON
( NAME = Music_dat,
FILENAME = 'D:\temp\musicdat.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5 )
LOG ON
( NAME = Music_log,
FILENAME = 'D:\temp\musiclog.ldf',
SIZE = 5,
MAXSIZE = 25,
FILEGROWTH = 5 );
GO
https://www.quackit.com/sql_server/t-sql/examples/create_database.cfm
Maybe afterall this is not needed because users can anyway place these scripts inside _init
directory. The _init
script files are executed only once and only when the target database is not yet created.