Skip to content

Commit

Permalink
fix: some properties do not reset after fields changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Dec 11, 2020
1 parent 9291a7a commit 3ed5ea0
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/renderer/components/WorkspacePropsTableRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<input
v-model="localRow.nullable"
type="checkbox"
:disabled="localRow.key === 'pri'"
:disabled="!isNullable"
>
<i class="form-icon" />
</label>
Expand Down Expand Up @@ -228,7 +228,7 @@
<label class="form-radio form-inline">
<input
v-model="defaultValue.type"
:disabled="localRow.key !== 'pri'"
:disabled="!canAutoincrement"
type="radio"
name="default"
value="autoincrement"
Expand Down Expand Up @@ -330,6 +330,12 @@ export default {
},
collations () {
return this.getWorkspace(this.selectedWorkspace).collations;
},
canAutoincrement () {
return this.indexes.some(index => ['PRIMARY', 'UNIQUE'].includes(index.type));
},
isNullable () {
return !this.indexes.some(index => ['PRIMARY'].includes(index.type));
}
},
watch: {
Expand All @@ -338,6 +344,13 @@ export default {
},
row () {
this.localRow = this.row;
},
indexes () {
if (!this.canAutoincrement)
this.localRow.autoIncrement = false;
if (!this.isNullable)
this.localRow.nullable = false;
}
},
mounted () {
Expand Down Expand Up @@ -433,6 +446,12 @@ export default {
if (!this.fieldType.collation)
this.localRow.collation = null;
if (!this.fieldType.unsigned)
this.localRow.unsigned = false;
if (!this.fieldType.zerofill)
this.localRow.zerofill = false;
}
if (this.editingField === 'default') {
Expand Down

0 comments on commit 3ed5ea0

Please sign in to comment.