public bool NeedToCreateTrackingTable(DbBuilderOption builderOption) { if (builderOption.HasFlag(DbBuilderOption.CreateOrUseExistingSchema)) { return(!MySqlManagementUtils.TableExists(connection, transaction, trackingName.UnquotedString)); } return(false); }
/// <summary> /// For a foreign key, check if the Parent table exists /// </summary> private bool EnsureForeignKeysTableExist(DmRelation foreignKey) { var childTable = foreignKey.ChildTable; var parentTable = foreignKey.ParentTable; // The foreignkey comes from the child table var ds = foreignKey.ChildTable.DmSet; if (ds == null) { return(false); } // Check if the parent table is part of the sync configuration var exist = ds.Tables.Any(t => ds.IsEqual(t.TableName.ToLowerInvariant(), parentTable.TableName.ToLowerInvariant())); if (!exist) { return(false); } bool alreadyOpened = connection.State == ConnectionState.Open; try { if (!alreadyOpened) { connection.Open(); } return(MySqlManagementUtils.TableExists(connection, transaction, parentTable.TableName.ToLowerInvariant())); } catch (Exception ex) { Debug.WriteLine($"Error during EnsureForeignKeysTableExist : {ex}"); throw; } finally { if (!alreadyOpened && connection.State != ConnectionState.Closed) { connection.Close(); } } }
public bool NeedToCreateTrackingTable() => !MySqlManagementUtils.TableExists(connection, transaction, trackingName);
public bool NeedToCreateTrackingTable() { return(!MySqlManagementUtils.TableExists(connection, transaction, trackingName.FullUnquotedString)); }
/// <summary> /// Check if we need to create the table in the current database /// </summary> public bool NeedToCreateTable() { return(!MySqlManagementUtils.TableExists(this.connection, this.transaction, this.tableName.FullUnquotedString)); }
/// <summary> /// Check if we need to create the table in the current database /// </summary> public bool NeedToCreateTable() => !MySqlManagementUtils.TableExists(this.connection, this.transaction, this.tableName);