diff options
author | Chris Smith <toonarmy@phpbb.com> | 2010-04-08 14:55:51 +0200 |
---|---|---|
committer | Chris Smith <toonarmy@phpbb.com> | 2010-04-08 17:28:47 +0200 |
commit | 02aed4b66f736ae0b78ba5971aa9f392749488e9 (patch) | |
tree | 22326c41ab4412bf02a62940fe9f2b4db17854e9 /build/webpi/install | |
parent | eaa591046f0016763105d9025db9a36255b3d4bd (diff) | |
download | forums-02aed4b66f736ae0b78ba5971aa9f392749488e9.tar forums-02aed4b66f736ae0b78ba5971aa9f392749488e9.tar.gz forums-02aed4b66f736ae0b78ba5971aa9f392749488e9.tar.bz2 forums-02aed4b66f736ae0b78ba5971aa9f392749488e9.tar.xz forums-02aed4b66f736ae0b78ba5971aa9f392749488e9.zip |
[feature/webpi] Package files for Microsoft Web Platform Installer
Diffstat (limited to 'build/webpi/install')
-rw-r--r-- | build/webpi/install/mssql.sql | 39 | ||||
-rw-r--r-- | build/webpi/install/mysql.sql | bin | 0 -> 732 bytes |
2 files changed, 39 insertions, 0 deletions
diff --git a/build/webpi/install/mssql.sql b/build/webpi/install/mssql.sql new file mode 100644 index 0000000000..390b4ffc02 --- /dev/null +++ b/build/webpi/install/mssql.sql @@ -0,0 +1,39 @@ +/**********************************************************************/
+/* Install.SQL */
+/* Creates a login and makes the user a member of db roles */
+/* */
+/**********************************************************************/
+
+-- Declare variables for database name, username and password
+DECLARE @dbName sysname,
+ @dbUser sysname,
+ @dbPwd nvarchar(max);
+
+-- Set variables for database name, username and password
+SET @dbName = 'PlaceHolderForDb';
+SET @dbUser = 'PlaceHolderForUser';
+SET @dbPwd = 'PlaceHolderForPassword';
+
+DECLARE @cmd nvarchar(max)
+
+-- Create login
+IF( SUSER_SID(@dbUser) is null )
+BEGIN
+ print '-- Creating login '
+ SET @cmd = N'CREATE LOGIN ' + quotename(@dbUser) + N' WITH PASSWORD ='''+ replace(@dbPwd, '''', '''''') + N''''
+ EXEC(@cmd)
+END
+
+-- Create database user and map to login
+-- and add user to the datareader, datawriter, ddladmin and securityadmin roles
+--
+SET @cmd = N'USE ' + quotename(@DBName) + N';
+IF( NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = ''' + replace(@dbUser, '''', '''''') + N'''))
+BEGIN
+ print ''-- Creating user'';
+ CREATE USER ' + quotename(@dbUser) + N' FOR LOGIN ' + quotename(@dbUser) + N';
+ print ''-- Adding user'';
+ EXEC sp_addrolemember ''db_owner'', ''' + replace(@dbUser, '''', '''''') + N''';
+END'
+EXEC(@cmd)
+GO
diff --git a/build/webpi/install/mysql.sql b/build/webpi/install/mysql.sql Binary files differnew file mode 100644 index 0000000000..ca9d1b2f83 --- /dev/null +++ b/build/webpi/install/mysql.sql |