Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres inherited client #1909

Merged
merged 32 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5a44b17
most functions moved over, still a bunch of cleaning up to do
not-night-but Jan 13, 2024
2e5970f
client works, still some hiccups to sort out
not-night-but Jan 18, 2024
bb70465
helper functions are now private member functions
not-night-but Jan 18, 2024
28a7ab7
fix typo in listRoutines
not-night-but Jan 18, 2024
d1d8334
starting to split up cockroach and redshift
not-night-but Jan 19, 2024
b161a0f
still exporting altertablesql
not-night-but Jan 19, 2024
cd441c1
manually merging in azmy's changes
not-night-but Jan 19, 2024
39d6fb5
Merge branch 'master' into postgres-client
not-night-but Jan 19, 2024
ceb78da
fix unit tests
not-night-but Jan 19, 2024
ec43832
unit tests use client now
not-night-but Jan 19, 2024
19cd763
dead import
not-night-but Jan 19, 2024
0f72188
fix parseQueryRowResult tests
not-night-but Jan 19, 2024
8234274
im dumb
not-night-but Jan 19, 2024
3c900e6
fix binding in query
not-night-but Jan 19, 2024
b812bf7
possibly fix pg tests
not-night-but Jan 25, 2024
3ad7b4d
Merge branch 'master' into postgres-client
not-night-but Jan 25, 2024
1248946
fix firebird errors
not-night-but Jan 25, 2024
c29ce82
fix typo in listTables query
not-night-but Jan 25, 2024
7fa9a28
fix undefined schema in query stream
not-night-but Jan 25, 2024
fe4573e
default schema properly
not-night-but Jan 25, 2024
1f174de
properly return redshift & cockroach clients, fix partitions
not-night-but Jan 25, 2024
e0aacee
Merge branch 'master' into postgres-client
not-night-but Jan 29, 2024
32077e3
add missing field in mysql table props
not-night-but Jan 29, 2024
d470214
hopefully fix the circular dependency
not-night-but Jan 29, 2024
1c49b56
fix listtables script for partitions
not-night-but Jan 29, 2024
2db21f2
actually import lodash. doh
not-night-but Jan 29, 2024
b6de0f5
fix getTableProperties
not-night-but Jan 30, 2024
b07b6d3
fix tests for cockroach
not-night-but Jan 30, 2024
2582f64
fix the insertRows hack
not-night-but Feb 1, 2024
564443b
run linting
not-night-but Feb 2, 2024
f4ef099
remove todos
not-night-but Feb 2, 2024
92fc71e
fix some goofs
not-night-but Feb 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/studio/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
multiple
/>
<data-manager />
<confirmation-modal :name="$confirmModalName"/>
<confirmation-modal :name="$confirmModalName" />
</div>
</template>

Expand Down
14 changes: 10 additions & 4 deletions apps/studio/src/components/CoreTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,19 @@
</modal>
</portal>

<confirmation-modal name="core-tabs-close-confirmation" ref="closeConfirmation">
<confirmation-modal
name="core-tabs-close-confirmation"
ref="closeConfirmation"
>
<template v-slot:title>
<div class="dialog-c-title">
Really close
<span class="tab-like" v-if="closingTab">
<tab-icon :tab="closingTab" /> {{ closingTab.title }}
</span>
<span
class="tab-like"
v-if="closingTab"
>
<tab-icon :tab="closingTab" /> {{ closingTab.title }}
</span>
?
</div>
</template>
Expand Down
18 changes: 15 additions & 3 deletions apps/studio/src/components/TabQueryEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,22 @@
class="actions btn-group"
ref="actions"
>
<x-button v-if="showDryRun" class="btn btn-flat btn-small" :disabled="$config.isCommunity" @click="dryRun = !dryRun">
<x-button
v-if="showDryRun"
class="btn btn-flat btn-small"
:disabled="$config.isCommunity"
@click="dryRun = !dryRun"
>
<x-label>Dry Run</x-label>
<i v-if="$config.isCommunity" class="material-icons menu-icon">stars</i>
<input v-else type="checkbox" v-model="dryRun">
<i
v-if="$config.isCommunity"
class="material-icons menu-icon"
>stars</i>
<input
v-else
type="checkbox"
v-model="dryRun"
>
</x-button>
<x-button
@click.prevent="triggerSave"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
>
<div class="dialog-content">
<slot name="title">
<div class="dialog-c-title" v-html="titleHtml"></div>
<div
class="dialog-c-title"
v-html="titleHtml"
/>
</slot>
<slot name="message">
<div v-html="messageHtml"></div>
<div v-html="messageHtml" />
</slot>
</div>
<div class="vue-dialog-buttons">
Expand Down
10 changes: 8 additions & 2 deletions apps/studio/src/components/sidebar/core/TableList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@
</div>
</div>

<x-progressbar v-show="tablesLoading" style="margin-top: -5px;" />
<x-progressbar
v-show="tablesLoading"
style="margin-top: -5px;"
/>

<!-- Pinned Tables -->
<div
Expand All @@ -75,7 +78,10 @@
<!-- Tables -->
<hr v-show="pinnedEntities.length > 0"> <!-- Fake splitjs Gutter styling -->

<nav class="list-group flex-col" ref="tables">
<nav
class="list-group flex-col"
ref="tables"
>
<div class="list-heading">
<span class="sub">Entities</span>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
:expanded="source.expanded"
:table="source.entity"
:pinned="source.pinned"
:loadingColumns="source.loadingColumns"
:loading-columns="source.loadingColumns"
@expand="onExpand($event, source)"
@pin="onPin($event, source)"
@contextmenu.prevent.stop="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
@click.prevent="$emit('expand', $event)"
@contextmenu.stop.prevent=""
>
<i v-if="displayParams.length > 0" class="dropdown-icon material-icons"
>keyboard_arrow_right</i
>
<i
v-if="displayParams.length > 0"
class="dropdown-icon material-icons"
>keyboard_arrow_right</i>
</span>
<span class="item-wrapper flex flex-middle expand">
<div
Expand All @@ -28,16 +29,24 @@
:title="title"
:class="iconClass"
class="item-icon entity-icon material-icons"
>functions</i
>
<i class="material-icons item-icon dh" v-if="draggable">menu</i>
>functions</i>
<i
class="material-icons item-icon dh"
v-if="draggable"
>menu</i>
</div>

<span class="table-name truncate" :title="routine.name">{{
<span
class="table-name truncate"
:title="routine.name"
>{{
routine.name
}}</span>
</span>
<span class="actions" :class="{ pinned: pinned }">
<span
class="actions"
:class="{ pinned: pinned }"
>
<span
class="btn-fab pin"
:class="{ pinned: pinned }"
Expand All @@ -49,16 +58,27 @@
</span>
</span>
</a>
<div v-if="expanded" class="sub-items">
<div
v-if="expanded"
class="sub-items"
>
<!-- <span class="sub-item" v-if="displayParams.length === 0">
<span class="title truncate">No Parameters</span>
</span> -->
<span :key="param.name" v-for="param in displayParams" class="sub-item">
<span class="title truncate" ref="title">{{ param.name }}</span>
<span class="badge" :class="param.type"
>{{ param.type
}}<span v-if="param.length">({{ param.length }})</span></span
>
<span
:key="param.name"
v-for="param in displayParams"
class="sub-item"
>
<span
class="title truncate"
ref="title"
>{{ param.name }}</span>
<span
class="badge"
:class="param.type"
>{{ param.type
}}<span v-if="param.length">({{ param.length }})</span></span>
</span>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,26 @@
class="table-item-wrapper"
:class="{ draggable: draggable, 'drag-handle': draggable }"
>
<table-icon :table="table" class="table-icon" />
<i class="material-icons item-icon dh" v-if="draggable">menu</i>
<table-icon
:table="table"
class="table-icon"
/>
<i
class="material-icons item-icon dh"
v-if="draggable"
>menu</i>
</span>
<span class="table-name truncate" :title="table.name">{{
<span
class="table-name truncate"
:title="table.name"
>{{
table.name
}}</span>
</span>
<span class="actions" :class="{ pinned: pinned }">
<span
class="actions"
:class="{ pinned: pinned }"
>
<span
class="btn-fab pin"
:class="{ pinned: pinned }"
Expand All @@ -45,8 +57,14 @@
</span>
</span>
</a>
<div v-if="expanded" class="sub-items">
<span class="sub-item" v-if="!loadingColumns && !table.columns?.length">
<div
v-if="expanded"
class="sub-items"
>
<span
class="sub-item"
v-if="!loadingColumns && !table.columns?.length"
>
No Columns
</span>
<template v-else-if="table.columns?.length > 0">
Expand All @@ -55,15 +73,23 @@
v-for="(c, i) in table.columns"
class="sub-item"
>
<span class="title truncate" ref="title" @click="selectColumn(i)">{{
<span
class="title truncate"
ref="title"
@click="selectColumn(i)"
>{{
c.columnName
}}</span>
<span class="badge" :class="c.dataType"
><span>{{ c.dataType }}</span></span
>
<span
class="badge"
:class="c.dataType"
><span>{{ c.dataType }}</span></span>
</span>
</template>
<span class="sub-item" v-else>
<span
class="sub-item"
v-else
>
Loading columns...
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:estimate-size="estimateItemHeight"
:keeps="keeps"
:extra-props="{ onExpand: handleExpand, onPin: handlePin }"
></virtual-list>
/>
</template>

<script lang="ts">
Expand Down
51 changes: 42 additions & 9 deletions apps/studio/src/components/tableview/EditorModal.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
<template>
<portal to="modals">
<modal :name="modalName" class="beekeeper-modal vue-dialog editor-dialog" @opened="onOpen">
<modal
:name="modalName"
class="beekeeper-modal vue-dialog editor-dialog"
@opened="onOpen"
>
<!-- Trap the key events so it doesn't conflict with the parent elements -->
<div class="dialog-content" tabindex="0" @keydown.stop @keyup.stop="handleKeyUp" @keypress.stop>
<div
class="dialog-content"
tabindex="0"
@keydown.stop
@keyup.stop="handleKeyUp"
@keypress.stop
>
<div class="top">
<div class="dialog-c-title">
Editing as
</div>

<select class="form-control language-select" v-model="languageName">
<option disabled value="" v-if="!languageName">
<select
class="form-control language-select"
v-model="languageName"
>
<option
disabled
value=""
v-if="!languageName"
>
Select a language
</option>
<option v-for="(lang, idx) in languages" :key="idx" :value="lang.name">
<option
v-for="(lang, idx) in languages"
:key="idx"
:value="lang.name"
>
{{ lang.label }}
</option>
</select>
Expand Down Expand Up @@ -41,18 +62,30 @@
</div>

<div class="editor-container">
<textarea name="editor" ref="editorRef" />
<textarea
name="editor"
ref="editorRef"
/>
</div>
</div>
<div class="bottom">
<span class="error-message" v-show="error">{{ error }}</span>
<span
class="error-message"
v-show="error"
>{{ error }}</span>

<div class="vue-dialog-buttons">
<span class="expand" />
<button @click.prevent="$modal.hide(modalName)" class="btn btn-sm btn-flat">
<button
@click.prevent="$modal.hide(modalName)"
class="btn btn-sm btn-flat"
>
Cancel
</button>
<button class="btn btn-sm btn-flat" @click.prevent="copy">
<button
class="btn btn-sm btn-flat"
@click.prevent="copy"
>
Copy
</button>
<x-button
Expand Down
15 changes: 11 additions & 4 deletions apps/studio/src/lib/db/clients/BasicDatabaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,27 @@ export abstract class BasicDatabaseClient<RawResultType> implements DatabaseClie
this.knex = knex;
this.contextProvider = contextProvider
}
listTablePartitions(_table: string): Promise<TablePartition[]> {
listTablePartitions(_table: string, _schema: string): Promise<TablePartition[]> {
return Promise.resolve([])
}
alterPartitionSql(_changes: AlterPartitionsSpec): string {
return ''
}
alterPartition: (changes: AlterPartitionsSpec) => Promise<void> = () => Promise.resolve();
getMaterializedViewCreateScript?: (view: string, schema?: string) => Promise<string[]> = () => Promise.resolve([]);

async alterPartition(_changes: AlterPartitionsSpec): Promise<void> {
return;
}

async getMaterializedViewCreateScript(_view: string, _schema?: string): Promise<string[]> {
return [];
}

abstract versionString(): string;

defaultSchema(): string | null {
return null
}


abstract getBuilder(table: string, schema?: string): ChangeBuilderBase

abstract supportedFeatures(): SupportedFeatures;
Expand Down