Repository: dotnet/efcore
File: test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsSqlServerTest.cs (C#)

Code before:
        SET @filename = REPLACE(left(@filename, len(@filename) - charindex('.', reverse(@filename))), '''', '''''') + N'_MOD';
        DECLARE @new_path nvarchar(max) = REPLACE(CAST(SERVERPROPERTY('InstanceDefaultDataPath') AS nvarchar(max)), '''', '''''') + @filename;

        EXEC(N'
            ALTER DATABASE CURRENT
            ADD FILE (NAME=''' + @filename + ''', filename=''' + @new_path + ''')
            TO FILEGROUP ' + @fg_name + ';')
        END
    END

IF SERVERPROPERTY('IsXTPSupported') = 1
EXEC(N'
    ALTER DATABASE CURRENT
    SET MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT ON;')
""",
            //
            """
CREATE TABLE [People] (
    [Id] int NOT NULL IDENTITY,
    CONSTRAINT [PK_People] PRIMARY KEY NONCLUSTERED ([Id])
) WITH (MEMORY_OPTIMIZED = ON);
""");
    }

    [ConditionalFact, SqlServerCondition(SqlServerCondition.SupportsMemoryOptimized)]
    [PlatformSkipCondition(TestUtilities.Xunit.TestPlatform.Mac)] // TODO: see #37647
    public virtual async Task Create_memory_optimized_temporal_table()
    {
        await Test(
            _ => { },
            builder => builder.UseIdentityColumns().Entity(
                "People", b =>
                {
                    b.ToTable("Customers", tb => tb.IsMemoryOptimized().IsTemporal());
                    b.Property<int>("Id");
                }),
            model =>
            {
                var table = Assert.Single(model.Tables);
                Assert.True((bool)table[SqlServerAnnotationNames.MemoryOptimized]!);
            });

        AssertSql(
            """
IF SERVERPROPERTY('IsXTPSupported') = 1 AND SERVERPROPERTY('EngineEdition') <> 5
    BEGIN
    IF NOT EXISTS (
        SELECT 1 FROM [sys].[filegroups] [FG] JOIN [sys].[database_files] [F] ON [FG].[data_space_id] = [F].[data_space_id] WHERE [FG].[type] = N'FX' AND [F].[type] = 2)
        BEGIN
        ALTER DATABASE CURRENT SET AUTO_CLOSE OFF;
        DECLARE @db_name nvarchar(max) = DB_NAME();

Review comment (bug):
Consider setting `SkipReason` on `PlatformSkipCondition` (e.g. mentioning #37647 and the SQL Server crash under Rosetta). Otherwise the test runner will report the generic default skip reason and the inline `// TODO` comment won’t show up in CI results.
```suggestion
    [PlatformSkipCondition(TestUtilities.Xunit.TestPlatform.Mac, SkipReason = "SQL Server crashes under Rosetta (#37647).")] // TODO: see #37647
```

Code after:
        SET @filename = REPLACE(left(@filename, len(@filename) - charindex('.', reverse(@filename))), '''', '''''') + N'_MOD';
        DECLARE @new_path nvarchar(max) = REPLACE(CAST(SERVERPROPERTY('InstanceDefaultDataPath') AS nvarchar(max)), '''', '''''') + @filename;

        EXEC(N'
            ALTER DATABASE CURRENT
            ADD FILE (NAME=''' + @filename + ''', filename=''' + @new_path + ''')
            TO FILEGROUP ' + @fg_name + ';')
        END
    END

IF SERVERPROPERTY('IsXTPSupported') = 1
EXEC(N'
    ALTER DATABASE CURRENT
    SET MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT ON;')
""",
            //
            """
CREATE TABLE [People] (
    [Id] int NOT NULL IDENTITY,
    CONSTRAINT [PK_People] PRIMARY KEY NONCLUSTERED ([Id])
) WITH (MEMORY_OPTIMIZED = ON);
""");
    }

    [ConditionalFact, SqlServerCondition(SqlServerCondition.SupportsMemoryOptimized)]
    [PlatformSkipCondition(
        TestUtilities.Xunit.TestPlatform.Mac,
        SkipReason = "SQL Server crashes under Rosetta on macOS; see #37647")]
    public virtual async Task Create_memory_optimized_temporal_table()
    {
        await Test(
            _ => { },
            builder => builder.UseIdentityColumns().Entity(
                "People", b =>
                {
                    b.ToTable("Customers", tb => tb.IsMemoryOptimized().IsTemporal());
                    b.Property<int>("Id");
                }),
            model =>
            {
                var table = Assert.Single(model.Tables);
                Assert.True((bool)table[SqlServerAnnotationNames.MemoryOptimized]!);
            });

        AssertSql(
            """
IF SERVERPROPERTY('IsXTPSupported') = 1 AND SERVERPROPERTY('EngineEdition') <> 5
    BEGIN
    IF NOT EXISTS (
        SELECT 1 FROM [sys].[filegroups] [FG] JOIN [sys].[database_files] [F] ON [FG].[data_space_id] = [F].[data_space_id] WHERE [FG].[type] = N'FX' AND [F].[type] = 2)
        BEGIN