Merge branch 'feature/opinionated-sql' of github.com:Budibase/budibase into feature/opinionated-sql

This commit is contained in:
Martin McKeaveney 2021-06-18 17:57:09 +01:00
commit ef0eadb402
3 changed files with 47 additions and 15 deletions

View File

@ -1,16 +1,8 @@
<script>
import { goto } from "@roxi/routify"
import { store, allScreens } from "builderStore"
import { tables } from "stores/backend"
import { notifications } from "@budibase/bbui"
import {
ActionMenu,
MenuItem,
Icon,
Modal,
ModalContent,
Input,
} from "@budibase/bbui"
import {goto} from "@roxi/routify"
import {allScreens, store} from "builderStore"
import {tables} from "stores/backend"
import {ActionMenu, Icon, Input, MenuItem, Modal, ModalContent, notifications} from "@budibase/bbui"
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
export let table
@ -22,9 +14,10 @@
let templateScreens
let willBeDeleted
$: external = table?.type === "external"
function showDeleteModal() {
const screens = $allScreens
templateScreens = screens.filter(screen => screen.autoTableId === table._id)
templateScreens = $allScreens.filter(screen => screen.autoTableId === table._id)
willBeDeleted = ["All table data"].concat(
templateScreens.map(screen => `Screen ${screen.props._instanceName}`)
)
@ -61,7 +54,9 @@
<Icon s hoverable name="MoreSmallList" />
</div>
<MenuItem icon="Edit" on:click={editorModal.show}>Edit</MenuItem>
<MenuItem icon="Delete" on:click={showDeleteModal}>Delete</MenuItem>
{#if !external}
<MenuItem icon="Delete" on:click={showDeleteModal}>Delete</MenuItem>
{/if}
</ActionMenu>
<Modal bind:this={editorModal}>

View File

@ -0,0 +1,28 @@
version: "3.8"
services:
db:
container_name: postgres
image: postgres
restart: always
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: main
ports:
- "5432:5432"
volumes:
#- pg_data:/var/lib/postgresql/data/
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
pgadmin:
container_name: pgadmin
image: dpage/pgadmin4
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: root@root.com
PGADMIN_DEFAULT_PASSWORD: root
ports:
- "5050:80"
#volumes:
# pg_data:

View File

@ -0,0 +1,9 @@
SELECT 'CREATE DATABASE main'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'main')\gexec
CREATE TABLE Persons (
PersonID int NOT NULL PRIMARY KEY,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);