diff --git a/source/helpers.pas b/source/helpers.pas index abb7c041..fd15a6f5 100644 --- a/source/helpers.pas +++ b/source/helpers.pas @@ -2642,6 +2642,7 @@ begin if Key.Name = '' then Key.Name := rx.Match[2]; // PRIMARY Key.OldName := Key.Name; Key.IndexType := rx.Match[2]; + Key.OldIndexType := Key.IndexType; Key.Algorithm := rx.Match[7]; if Key.IndexType = '' then Key.IndexType := 'KEY'; // KEY Key.Columns := Explode(',', rx.Match[5]); diff --git a/source/mysql_connection.pas b/source/mysql_connection.pas index 851ca4ba..6262f5ce 100644 --- a/source/mysql_connection.pas +++ b/source/mysql_connection.pas @@ -70,7 +70,7 @@ type TTableKey = class(TObject) public Name, OldName: String; - IndexType, Algorithm: String; + IndexType, OldIndexType, Algorithm: String; Columns, SubParts: TStringList; Modified, Added: Boolean; constructor Create; diff --git a/source/table_editor.pas b/source/table_editor.pas index 652daf38..ab109090 100644 --- a/source/table_editor.pas +++ b/source/table_editor.pas @@ -433,6 +433,8 @@ begin end; DeletedKeys.Clear; for i:=0 to FKeys.Count-1 do begin + FKeys[i].OldName := FKeys[i].Name; + FKeys[i].OldIndexType := FKeys[i].IndexType; FKeys[i].Added := False; FKeys[i].Modified := False; end; @@ -563,7 +565,7 @@ begin for i:=0 to FKeys.Count-1 do begin Mainform.ProgressBarStatus.StepIt; if FKeys[i].Modified and (not FKeys[i].Added) then begin - if FKeys[i].IndexType = PKEY then + if FKeys[i].OldIndexType = PKEY then IndexSQL := 'PRIMARY KEY' else IndexSQL := 'INDEX ' + Mainform.Mask(FKeys[i].OldName); @@ -1247,6 +1249,7 @@ begin TblKey.Name := 'Index '+IntToStr(FKeys.Count+1); TblKey.OldName := TblKey.Name; TblKey.IndexType := KEY; + TblKey.OldIndexType := TblKey.IndexType; TblKey.Added := True; FKeys.Add(TblKey); Modification(Sender);