sqlmig: init crée aussi 02grants.sql

This commit is contained in:
Jephté Clain 2018-12-08 15:48:12 +04:00
parent de5727e7e2
commit af2b74f31f
1 changed files with 11 additions and 1 deletions

12
sqlmig
View File

@ -1034,6 +1034,16 @@ drop database if exists @@database@@;"
create database @@database@@;"
fi
if [ ! -f "$dbdir/02grants.sql" ]; then
estep "02grants.sql"
echo >"$dbdir/02grants.sql" "\
-- -*- coding: utf-8 mode: sql -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
-- @sqlmig admin
create user '$dbname' identified by '$dbname';
grant all privileges on $dbname.* to '$dbname';"
fi
if [ ! -f "$dbdir/my.cnf" ]; then
estep "my.cnf"
echo >"$dbdir/my.cnf" "\
@ -1078,7 +1088,7 @@ drop user $dbname cascade;"
-- -*- coding: utf-8 mode: sql -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
-- @sqlmig create
create user $dbname identified by \"password\";
create user $dbname identified by \"$dbname\";
grant connect to $dbname;
grant resource to $dbname;"
fi