Skip to content

Commit 4e8427f

Browse files
committed
disable foreign keys in sqlite always
1 parent ea77c76 commit 4e8427f

3 files changed

Lines changed: 1 addition & 26 deletions

File tree

src/Migrator.Tests/Data/TestMigrations.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using DotNetProjects.Migrator.Framework;
2-
using DotNetProjects.Migrator.Providers.Impl.SQLite;
32

43
namespace Migrator.Tests.Data;
54

@@ -65,22 +64,3 @@ public virtual void InitializeOnce(string[] args)
6564
{
6665
}
6766
}
68-
69-
[Migration(3, DisableForeignKeysInSqlite = true)]
70-
public class ThirdTestMigration : Migration
71-
{
72-
public override void Up()
73-
{
74-
if (this.Database is SQLiteTransformationProvider sqlite)
75-
{
76-
if (sqlite.IsPragmaForeignKeysOn())
77-
{
78-
throw new System.Exception("Disableling of Foreign keys was not possible");
79-
}
80-
}
81-
}
82-
83-
public override void Down()
84-
{
85-
}
86-
}

src/Migrator/Framework/MigrationAttribute.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,4 @@ public bool Ignore
5555
get { return _ignore; }
5656
set { _ignore = value; }
5757
}
58-
59-
/// <summary>
60-
/// Disable Foreign Keys in Sqlite
61-
/// </summary>
62-
public bool DisableForeignKeysInSqlite { get; set; }
6358
}

src/Migrator/MigrateAnywhere.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public override void Migrate(IMigration migration)
6969
var attr = (MigrationAttribute)Attribute.GetCustomAttribute(migration.GetType(), typeof(MigrationAttribute));
7070
#endif
7171
var foreignKeysWasOn = false;
72-
if (attr.DisableForeignKeysInSqlite && _provider is SQLiteTransformationProvider sqlite)
72+
if (_provider is SQLiteTransformationProvider sqlite)
7373
{
7474
foreignKeysWasOn = sqlite.IsPragmaForeignKeysOn();
7575
if (foreignKeysWasOn)

0 commit comments

Comments
 (0)