FileGroup support

Hello,

Isn't the tool supposed to create all custom filegroups as part of Pre-Deployment scripts? I would expect this to be the case, judging from the documentation and from ReadyRoll 1.10 change log containing fix for ‘FileGroup does not exist’ errors upon importing tables that are stored on custom filegroups. This is really close to the issue I am facing right now, except the error message is 'Object '[filegroupname]' does not exist'.

Probably worth noting is that my sqlproj file contains FileGroup setting in SyncToOfflineSchemaModelObjectTypes, and SyncOptionIgnoreDataspaces is set to false, yet the filegroup do not show up anywhere in schema-model structure.

Version is 1.14.13.4777

Thanks
Pavel
Tagged:

Best Answer

  • dnlnlndnlnln Posts: 234 Gold 2
    Hi Pavel,

    Thanks for your interest in ReadyRoll. Unfortunately ReadyRoll does not currently script filegroups. The fix referred to in ReadyRoll 1.10 simply resulted in filegroup references being omitted from the generated scripts, rather than actually generating the scripts for the dependent filegroup themselves.

    These need to be scripted in another tool (e.g. in SSMS, by right-clicking the database selecting Script database as... CREATE) and added to the Pre-Deployment “CREATE DATABASE” statement. Alternatively, they can also be added as an “ALTER DATABASE” statement in a migration, providing transactions switched are off for that migration.

    Variables can be used to soft-code the data and log paths for each respective filegroup. For example, here is the Pre-Deployment\01_Create_Database.sql script for the Microsoft sample database, WideWorldImporters, e.g.:
    IF NOT EXISTS(SELECT 1 FROM sys.databases WHERE name = N'$(DatabaseName)')
    BEGIN
    	CREATE DATABASE [$(DatabaseName)]
    	ON PRIMARY
    	(
    		NAME = WWI_Primary,
    		FILENAME = '$(DefaultDataPath)$(DefaultFilePrefix).mdf',
    		SIZE = 500MB,
    		MAXSIZE = UNLIMITED,
    		FILEGROWTH = 64MB
    	),
    	FILEGROUP USERDATA DEFAULT
    	(
    		NAME = WWI_UserData,
    		FILENAME = '$(DefaultDataPath)$(DefaultFilePrefix)_UserData.ndf',
    		SIZE = 500MB,
    		MAXSIZE = UNLIMITED,
    		FILEGROWTH = 64MB
    	),
    	FILEGROUP [WWI_InMemory_Data] CONTAINS MEMORY_OPTIMIZED_DATA  DEFAULT
    	( 
    		NAME = WWI_InMemory_Data_1,
    		FILENAME = N'$(DefaultDataPath)(DefaultFilePrefix)_InMemory_Data_1',
    		MAXSIZE = UNLIMITED
    	)
    	LOG ON
    	(
    		NAME = WWI_Log,
    		FILENAME = '$(DefaultLogPath)$(DefaultFilePrefix).ldf',
    		SIZE = 100MB,
    		MAXSIZE = UNLIMITED,
    		FILEGROWTH = 64MB
    	);
    END
    GO
    

    If you would like to see filegroup script generation within ReadyRoll, it would be great if you could submit a suggestion for this to our uservoice site.
    Daniel Nolan
    Product Manager
    Redgate Software

Answers

Sign In or Register to comment.