{"action":"created","issue":{"url":"https://api.github.com/repos/PowerShell/xSQLServer/issues/57","repository_url":"https://api.github.com/repos/PowerShell/xSQLServer","labels_url":"https://api.github.com/repos/PowerShell/xSQLServer/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/PowerShell/xSQLServer/issues/57/comments","events_url":"https://api.github.com/repos/PowerShell/xSQLServer/issues/57/events","html_url":"https://github.com/PowerShell/xSQLServer/issues/57","id":153593716,"number":57,"title":"Request resource xSQLServerDatabaseFile (suggestion)","user":{"login":"johlju","id":7189721,"avatar_url":"https://avatars3.githubusercontent.com/u/7189721?v=3","gravatar_id":"","url":"https://api.github.com/users/johlju","html_url":"https://github.com/johlju","followers_url":"https://api.github.com/users/johlju/followers","following_url":"https://api.github.com/users/johlju/following{/other_user}","gists_url":"https://api.github.com/users/johlju/gists{/gist_id}","starred_url":"https://api.github.com/users/johlju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johlju/subscriptions","organizations_url":"https://api.github.com/users/johlju/orgs","repos_url":"https://api.github.com/users/johlju/repos","events_url":"https://api.github.com/users/johlju/events{/privacy}","received_events_url":"https://api.github.com/users/johlju/received_events","type":"User","site_admin":false},"labels":[{"id":200152072,"url":"https://api.github.com/repos/PowerShell/xSQLServer/labels/help%20wanted","name":"help wanted","color":"159818","default":true},{"id":418363656,"url":"https://api.github.com/repos/PowerShell/xSQLServer/labels/resource%20proposal","name":"resource proposal","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-05-07T13:11:46Z","updated_at":"2017-06-23T06:37:58Z","closed_at":null,"body":"## xSQLServerDatabaseFile\r\n\r\nI would like to see a new resource  `xSQLServerDatabaseFile` which can add and modify data file and/or log file. \r\nComments on this appreciated.\r\n### Description\r\n\r\nI can see this resource take multiple names of files. So it can create one file or several files depending on the users requirement. But I think the resource should not create Log and Data files at the same time. User should implement two steps n the configuration file for adding both log and data files.\r\nI don't see this module to be able to move data or log file to a new path, maybe that can be a improvement. With modify I mean it can make sure sizes are always the same, if user wants that. \r\n### Usage\r\n\r\nI personally want to be able to use this to modify the tempdb as well as other databases.\r\n### Schema suggestion\r\n\r\n**NodeName** - The host name of the SQL Server.\r\n**InstanceName** - The instance name of the SQL Server. Default is `'MSSQLSERVER'`.\r\n**Ensure** - If the file should me present or absent, and if it present if the sizes should be enforced. Valid values are `'Present'`, `'PresentAndSize'`, `'Absent'`.\r\n**Name** - Name of the file. Will be used as name and display name.\r\n**Path** - The path where file will be created. It defaults to the path of the first file returned.\r\n**FileType** - The type of file to create. Valid values are `'DATA'`,`'LOG'`. Defaults to `'DATA'`. \r\n**FileGroup** - The file group to add the data file to. Defaults to `'PRIMARY'`. Ignored if `-FileType` is `'LOG'`.\r\n**GrowthType** - The auto growth type. Valid values are `'Percent'` or `'MB'`.\r\n**Growth** - The auto growth size for the file. Value is in percent or MB depending of `-GrowthType`.\r\n**IntialSize** - The initial size of the file in MB. If `-Ensure` is set to `'PresentAndSize'` then the initial size will be tried to be enforced. \r\n**MaxSize** -  The max size of the file in MB, or `-1`for unlimited size. If `-Ensure` is set to `'PresentAndSize'` and `-MaxSize` does not equal `-1` then the max size will be tried to be enforced. \r\n"},"comment":{"url":"https://api.github.com/repos/PowerShell/xSQLServer/issues/comments/310584772","html_url":"https://github.com/PowerShell/xSQLServer/issues/57#issuecomment-310584772","issue_url":"https://api.github.com/repos/PowerShell/xSQLServer/issues/57","id":310584772,"user":{"login":"johlju","id":7189721,"avatar_url":"https://avatars3.githubusercontent.com/u/7189721?v=3","gravatar_id":"","url":"https://api.github.com/users/johlju","html_url":"https://github.com/johlju","followers_url":"https://api.github.com/users/johlju/followers","following_url":"https://api.github.com/users/johlju/following{/other_user}","gists_url":"https://api.github.com/users/johlju/gists{/gist_id}","starred_url":"https://api.github.com/users/johlju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johlju/subscriptions","organizations_url":"https://api.github.com/users/johlju/orgs","repos_url":"https://api.github.com/users/johlju/repos","events_url":"https://api.github.com/users/johlju/events{/privacy}","received_events_url":"https://api.github.com/users/johlju/received_events","type":"User","site_admin":false},"created_at":"2017-06-23T06:37:58Z","updated_at":"2017-06-23T06:37:58Z","body":"Looking at the link, I see for FileGrowth it defaults to MB if none is set, so we should have MB as default here as well\r\n>  The value can be specified in MB, KB, GB, TB, or percent (%). If a number is specified without an MB, KB, or % suffix, the default is MB. \r\n\r\nAlso suggest changing 'Growth' to 'GrowthSize'.\r\n\r\nI suggest adding a parameter 'FileGroupName' to be able to add the data file to a file group. Should this resource create and remove file groups since those need even more more parameters? I suggest No.\r\nI suggest that another new resource xSQLServerDatabaseFileGroup resource has the ability to add, remove and set default file group, and any other properties of a file group. If a new resource for file group seems like a good idea, then I can submit an issue for that.\r\n\r\nHere is the schema with the suggestions above.\r\n\r\n```\r\n[ClassVersion(\"1.0.0.0\"), FriendlyName(\"xSQLServerDatabaseFile\")]\r\nclass MSFT_xSQLServerDatabaseFile : OMI_BaseResource\r\n{\r\n    [Key, Description(\"The name of the database to be configured.\")] String DatabaseName;\r\n    [Key, Description(\"The host name of the SQL Server to be configured.\")] String SQLServer;\r\n    [Key, Description(\"The name of the SQL instance to be configured.\")] String SQLInstanceName;\r\n    [Key, Description(\"The name of the file. Will be used as name and display name.\")] String Name;\r\n    [Write, Description(\"An enumerated value that describes if the file should be added ('Present') or removed ('Absent'). Default value is 'Present'.\"), ValueMap{\"Present\",\"Absent\"}, Values{\"Present\",\"Absent\"}] String Ensure;\r\n    [Write, Description(\"If the size parameters should be enforced. Default value is $false.\")] Boolean Force;\r\n    [Write, Description(\"The path where file will be created. It defaults to the path of the first file returned.\")] String Path;\r\n    [Write, Description(\"The type of file to create. Valid values are 'Data','Log'. Defaults to 'Data'.\"), ValueMap{\"Data\",\"Log\"}, Values{\"Data\",\"Log\"}] String FileType;\r\n    [Write, Description(\"The file group to add the data file to. Defaults to 'PRIMARY'. Ignored if parameter 'FileType' is set to 'Log'.\")] String FileGroup;\r\n    [Write, Description(\"The auto growth type. Valid values are 'Percent', 'Kilobyte', 'Megabyte', 'Gigabyte', or 'Terabyte'. Default value is 'Megabyte'.\"), ValueMap{\"Percent\",\"Kilobyte\",\"Megabyte\",\"Gigabyte\",\"Terabyte\"}, Values{\"Percent\",\"Kilobyte\",\"Megabyte\",\"Gigabyte\",\"Terabyte\"}] String GrowthType;\r\n    [Write, Description(\"The auto growth size for the file. Value is in the unit of measurement specified in the parameter 'GrowthType'.\")] sint64 GrowthSize;\r\n    [Write, Description(\"The initial size of the file in bytes. If parameter 'Force' is set to $true then the initial size will tried to be enforced.\")] sint64 IntialSize;\r\n    [Write, Description(\"The max size of the file in bytes, or set to '-1' for unlimited size. If parameter 'Force' is set to $true and parameter 'MaxSize' does not equal '-1' then the max size will tried to be enforced.\")] String MaxSize;\r\n    [Write, Description(\"The filegroup to which to add the specified file. Ignored if file type is set to 'Log'. If not set, the file will be added to the default file group.\")] String FileGroupName;\r\n};\r\n```"}}
{"actor":{"display_login":"johlju"}}