Implement unique constraint support (#4467)

* Allow creating unique fields

* Allow removing unique constriant

* Show unique constraint error as validation error in app
This commit is contained in:
Rijk van Zanten
2021-03-10 17:35:21 -05:00
committed by GitHub
parent 7569168e3e
commit 4248b187bb
7 changed files with 35 additions and 5 deletions

View File

@@ -1,6 +1,5 @@
<template>
<div>
<div class="form">
<div class="field">
<div class="label type-label">
@@ -139,6 +138,16 @@
block
/>
</div>
<div class="field half-right" v-if="fieldData.schema">
<div class="label type-label">{{ $t('unique') }}</div>
<v-checkbox
:input-value="fieldData.schema.is_unique"
@change="fieldData.schema.is_unique = $event"
:label="$t('value_unique')"
block
/>
</div>
</div>
</div>
</template>

View File

@@ -43,6 +43,7 @@ function initLocalStore(collection: string, field: string, type: typeof localTyp
default_value: undefined,
max_length: undefined,
is_nullable: true,
is_unique: false,
numeric_precision: null,
numeric_scale: null,
},