Commits

Yury Shulaev  committed 89dd965

add relation type check

  • Participants
  • Parent commits 838b57f

Comments (0)

Files changed (3)

File js/wwwsqldesigner.js

 }
 
 SQL.Designer.prototype.promptRelationType = function () {
-	return prompt(_("relationtype"), "dummy");
+	var type;
+	var typeValid;
+
+	do  {
+		type = prompt(_("relationtype"), "dummy");
+		typeValid = !type || type == "dummy" || type == "default" || type == "cascade";
+
+		if (!typeValid) {
+			alert(_("invalidrelationtype"));
+		}
+	} while (!typeValid);
+
+	return type;
 }

File locale/en.xml

 	<string name="foreignconnect">Connect foreign key</string>
 	<string name="foreignconnectpending">click target row</string>
 	<string name="relationtype">Relation type (dummy, default, cascade)</string>
+	<string name="invalidrelationtype">Invalid relation type. Use one of these: dummy, default, cascade</string>
 	<string name="foreigndisconnect">Remove foreign key</string>
 	<string name="confirmtable">Really delete table</string>
 	<string name="confirmrow">Really delete field</string>

File locale/ru.xml

 	<string name="foreignconnect">Связать внешний ключ</string>
 	<string name="foreignconnectpending">выберите целевое поле</string>
 	<string name="relationtype">Тип связи (dummy, default, cascade)</string>
+	<string name="invalidrelationtype">Неверный тип связи. Используйте одно из следующих значений: dummy, default, cascade</string>
 	<string name="foreigndisconnect">Удалить внешний ключ</string>
 	<string name="confirmtable">Действительно удалить таблицу</string>
 	<string name="confirmrow">Действительно удалить поле</string>