-
Notifications
You must be signed in to change notification settings - Fork 228
feat: add bigint column type support and update dependencies #2950
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
Open
ArnabChatterjee20k
wants to merge
5
commits into
main
Choose a base branch
from
big-int
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0c38cda
feat: add bigint column type support and update dependencies
ArnabChatterjee20k 272f2e9
feat: enhance bigint column support and improve input handling
ArnabChatterjee20k 528c657
feat: extend bigint support in database table components
ArnabChatterjee20k 501fdbb
updated bun lock
ArnabChatterjee20k a6eb30d
linting
ArnabChatterjee20k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ const columnTypes = [ | |
| 'text', | ||
| 'mediumtext', | ||
| 'longtext', | ||
| 'bigint', | ||
| 'integer', | ||
| 'double', | ||
| 'boolean', | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
...ject-[region]-[project]/databases/database-[database]/table-[table]/columns/bigint.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| <script module lang="ts"> | ||
| import { page } from '$app/state'; | ||
| import { sdk } from '$lib/stores/sdk'; | ||
| import type { Models } from '@appwrite.io/console'; | ||
|
|
||
| export async function submitBigInt( | ||
| databaseId: string, | ||
| tableId: string, | ||
| key: string, | ||
| data: Partial<Models.ColumnBigint> | ||
| ) { | ||
| await sdk.forProject(page.params.region, page.params.project).tablesDB.createBigIntColumn({ | ||
| databaseId, | ||
| tableId, | ||
| key, | ||
| required: data.required, | ||
| min: data.min, | ||
| max: data.max, | ||
| xdefault: data.default, | ||
| array: data.array | ||
| }); | ||
| } | ||
|
|
||
| export async function updateBigInt( | ||
| databaseId: string, | ||
| tableId: string, | ||
| data: Partial<Models.ColumnBigint>, | ||
| originalKey?: string | ||
| ) { | ||
| await sdk.forProject(page.params.region, page.params.project).tablesDB.updateBigIntColumn({ | ||
| databaseId, | ||
| tableId, | ||
| key: originalKey, | ||
| required: data.required, | ||
| xdefault: data.default, | ||
| min: data.min, | ||
| max: data.max, | ||
| newKey: data.key !== originalKey ? data.key : undefined | ||
| }); | ||
| } | ||
| </script> | ||
|
|
||
| <script lang="ts"> | ||
| import { Layout } from '@appwrite.io/pink-svelte'; | ||
| import { InputNumber } from '$lib/elements/forms'; | ||
| import { createConservative } from '$lib/helpers/stores'; | ||
| import RequiredArrayCheckboxes from './requiredArrayCheckboxes.svelte'; | ||
|
|
||
| type Props = { | ||
| editing?: boolean; | ||
| disabled?: boolean; | ||
| data?: Partial<Models.ColumnBigint>; | ||
| }; | ||
|
|
||
| let { | ||
| editing = false, | ||
| disabled = false, | ||
| data = $bindable({ | ||
| required: false, | ||
| min: 0, | ||
| max: 0, | ||
| default: 0, | ||
| array: false | ||
| }) | ||
| }: Props = $props(); | ||
|
|
||
| let savedDefault = data.default; | ||
|
|
||
| function handleDefaultState(hideDefault: boolean) { | ||
| if (hideDefault) { | ||
| savedDefault = data.default; | ||
| data.default = null; | ||
| } else { | ||
| data.default = savedDefault; | ||
| } | ||
| } | ||
|
|
||
| const { | ||
| stores: { required, array }, | ||
| listen | ||
| } = createConservative<Partial<Models.ColumnBigint>>({ | ||
| required: false, | ||
| array: false, | ||
| ...data | ||
| }); | ||
| $effect(() => { | ||
| listen(data); | ||
| }); | ||
|
|
||
| $effect(() => { | ||
| handleDefaultState($required || $array); | ||
| }); | ||
| </script> | ||
|
|
||
| <Layout.Stack direction="row" gap="s"> | ||
| <InputNumber | ||
| id="min" | ||
| label="Min" | ||
| {disabled} | ||
| placeholder="Enter size" | ||
| bind:value={data.min as number} | ||
| required={editing} /> | ||
|
|
||
| <InputNumber | ||
| id="max" | ||
| label="Max" | ||
| {disabled} | ||
| placeholder="Enter size" | ||
| bind:value={data.max as number} | ||
| required={editing} /> | ||
| </Layout.Stack> | ||
|
|
||
| <InputNumber | ||
| id="default" | ||
| label="Default value" | ||
| placeholder="Enter value" | ||
| min={data.min as number} | ||
| max={data.max as number} | ||
| bind:value={data.default as number} | ||
| disabled={data.required || data.array || disabled} | ||
| nullable={(!data.required && !data.array) || disabled} /> | ||
|
|
||
| <RequiredArrayCheckboxes | ||
| {editing} | ||
| {disabled} | ||
| bind:array={data.array} | ||
| bind:required={data.required} /> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.