Merge pull request #9689 from Budibase/fix/9654
Fix for SQL many-to-many configuration via relationship modal
This commit is contained in:
commit
aaa8903b20
|
@ -42,25 +42,16 @@ services:
|
||||||
|
|
||||||
couchdb-service:
|
couchdb-service:
|
||||||
# platform: linux/amd64
|
# platform: linux/amd64
|
||||||
container_name: budi-couchdb-dev
|
container_name: budi-couchdb3-dev
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
image: ibmcom/couchdb3
|
image: budibase/couchdb
|
||||||
environment:
|
environment:
|
||||||
- COUCHDB_PASSWORD=${COUCH_DB_PASSWORD}
|
- COUCHDB_PASSWORD=${COUCH_DB_PASSWORD}
|
||||||
- COUCHDB_USER=${COUCH_DB_USER}
|
- COUCHDB_USER=${COUCH_DB_USER}
|
||||||
ports:
|
ports:
|
||||||
- "${COUCH_DB_PORT}:5984"
|
- "${COUCH_DB_PORT}:5984"
|
||||||
volumes:
|
volumes:
|
||||||
- couchdb3_data:/opt/couchdb/data
|
- couchdb_data:/data
|
||||||
|
|
||||||
couch-init:
|
|
||||||
container_name: budi-couchdb-init-dev
|
|
||||||
image: curlimages/curl
|
|
||||||
environment:
|
|
||||||
PUT_CALL: "curl -u ${COUCH_DB_USER}:${COUCH_DB_PASSWORD} -X PUT couchdb-service:5984"
|
|
||||||
depends_on:
|
|
||||||
- couchdb-service
|
|
||||||
command: ["sh","-c","sleep 10 && $${PUT_CALL}/_users && $${PUT_CALL}/_replicator; fg;"]
|
|
||||||
|
|
||||||
redis-service:
|
redis-service:
|
||||||
container_name: budi-redis-dev
|
container_name: budi-redis-dev
|
||||||
|
@ -73,7 +64,7 @@ services:
|
||||||
- redis_data:/data
|
- redis_data:/data
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
couchdb3_data:
|
couchdb_data:
|
||||||
driver: local
|
driver: local
|
||||||
minio_data:
|
minio_data:
|
||||||
driver: local
|
driver: local
|
||||||
|
|
|
@ -152,7 +152,7 @@
|
||||||
fromTable,
|
fromTable,
|
||||||
throughTable,
|
throughTable,
|
||||||
fromTable.primary[0],
|
fromTable.primary[0],
|
||||||
throughFromKey
|
throughToKey
|
||||||
),
|
),
|
||||||
throughToKey:
|
throughToKey:
|
||||||
errorChecker.manyForeignKeySet(throughToKey) ||
|
errorChecker.manyForeignKeySet(throughToKey) ||
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
toTable,
|
toTable,
|
||||||
throughTable,
|
throughTable,
|
||||||
toTable.primary[0],
|
toTable.primary[0],
|
||||||
throughToKey
|
throughFromKey
|
||||||
),
|
),
|
||||||
fromForeign:
|
fromForeign:
|
||||||
errorChecker.foreignKeySet(fromForeign) ||
|
errorChecker.foreignKeySet(fromForeign) ||
|
||||||
|
@ -391,24 +391,14 @@
|
||||||
options={Object.keys(getTable(throughId)?.schema)}
|
options={Object.keys(getTable(throughId)?.schema)}
|
||||||
bind:value={throughToKey}
|
bind:value={throughToKey}
|
||||||
bind:error={errors.throughToKey}
|
bind:error={errors.throughToKey}
|
||||||
on:change={e =>
|
on:change={changed}
|
||||||
changed(() => {
|
|
||||||
if (throughFromKey === e.detail) {
|
|
||||||
throughFromKey = null
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
label={`Foreign Key (${getTable(toId)?.name})`}
|
label={`Foreign Key (${getTable(toId)?.name})`}
|
||||||
options={Object.keys(getTable(throughId)?.schema)}
|
options={Object.keys(getTable(throughId)?.schema)}
|
||||||
bind:value={throughFromKey}
|
bind:value={throughFromKey}
|
||||||
bind:error={errors.throughFromKey}
|
bind:error={errors.throughFromKey}
|
||||||
on:change={e =>
|
on:change={changed}
|
||||||
changed(() => {
|
|
||||||
if (throughToKey === e.detail) {
|
|
||||||
throughToKey = null
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{:else if isManyToOne && toId}
|
{:else if isManyToOne && toId}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
SELECT 'CREATE DATABASE main'
|
||||||
|
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'main')\gexec
|
||||||
|
CREATE SCHEMA test;
|
||||||
|
CREATE TABLE territories (
|
||||||
|
territory_id character varying(20) PRIMARY KEY,
|
||||||
|
territory_description character varying(60) NOT NULL
|
||||||
|
);
|
||||||
|
CREATE TABLE employees (
|
||||||
|
employee_id smallint PRIMARY KEY,
|
||||||
|
last_name character varying(20) NOT NULL,
|
||||||
|
first_name character varying(10) NOT NULL,
|
||||||
|
title character varying(30),
|
||||||
|
title_of_courtesy character varying(25),
|
||||||
|
birth_date date,
|
||||||
|
hire_date date,
|
||||||
|
address character varying(60),
|
||||||
|
city character varying(15),
|
||||||
|
region character varying(15),
|
||||||
|
postal_code character varying(10),
|
||||||
|
country character varying(15),
|
||||||
|
home_phone character varying(24),
|
||||||
|
extension character varying(4),
|
||||||
|
photo bytea,
|
||||||
|
notes text,
|
||||||
|
reports_to smallint REFERENCES employees(employee_id),
|
||||||
|
photo_path character varying(255)
|
||||||
|
);
|
||||||
|
CREATE TABLE employee_territories (
|
||||||
|
employee_id smallint REFERENCES employees(employee_id),
|
||||||
|
territory_id character varying(20) REFERENCES territories(territory_id),
|
||||||
|
CONSTRAINT pk_employee_territories PRIMARY KEY (employee_id, territory_id)
|
||||||
|
);
|
Loading…
Reference in New Issue