-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alexis Rico <[email protected]> Co-authored-by: Alexis Rico <[email protected]> Co-authored-by: Andrew Farries <[email protected]>
- Loading branch information
1 parent
56c09d1
commit a4eb87b
Showing
1 changed file
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,99 @@ | ||
import { Schemas } from '@xata.io/client'; | ||
|
||
export type BranchSchemaFormatted = | ||
| { | ||
schema: { | ||
tables: { | ||
name: string; | ||
uniqueConstraints: Schemas.BranchSchema['tables'][number]['uniqueConstraints']; | ||
checkConstraints: Schemas.BranchSchema['tables'][number]['checkConstraints']; | ||
foreignKeys: Schemas.BranchSchema['tables'][number]['foreignKeys']; | ||
columns: { | ||
name: string; | ||
type: string; | ||
unique: boolean; | ||
notNull: boolean; | ||
defaultValue: any; | ||
comment: string; | ||
}[]; | ||
}[]; | ||
}; | ||
} | ||
| undefined; | ||
|
||
export type ColumnData = { | ||
name: string; | ||
type: string; | ||
unique: boolean; | ||
nullable: boolean; | ||
defaultValue?: string; | ||
vector?: { | ||
dimension: number; | ||
}; | ||
originalName: string; | ||
tableName: string; | ||
link?: { | ||
table: string; | ||
}; | ||
file?: { | ||
defaultPublicAccess: boolean; | ||
}; | ||
'file[]'?: { | ||
defaultPublicAccess: boolean; | ||
}; | ||
}; | ||
|
||
export type AddTablePayload = { | ||
type: 'add-table'; | ||
table: { | ||
name: string; | ||
}; | ||
}; | ||
|
||
export type EditTablePayload = { | ||
type: 'edit-table'; | ||
table: { | ||
name: string; | ||
newName: string; | ||
}; | ||
}; | ||
|
||
export type DeleteTablePayload = { | ||
name: string; | ||
}; | ||
|
||
export type AddColumnPayload = { | ||
type: 'add-column'; | ||
tableName: string; | ||
column: ColumnData; | ||
}; | ||
|
||
export type EditColumnPayload = { | ||
type: 'edit-column'; | ||
column: ColumnData; | ||
}; | ||
|
||
export type DeleteColumnPayload = { [tableName: string]: string[] }; | ||
|
||
export type FormatPayload = { | ||
type: 'space' | 'migrate' | 'schema'; | ||
}; | ||
|
||
export type SelectChoice = { | ||
name: FormatPayload | AddTablePayload | EditTablePayload | AddColumnPayload | EditColumnPayload; | ||
message: string; | ||
role?: string; | ||
choices?: SelectChoice[]; | ||
disabled?: boolean; | ||
hint?: string; | ||
}; | ||
|
||
export type ValidationState = { | ||
values: { name: string }; | ||
items: { name: string; input: string }[]; | ||
fields: { name: string; initial: string }[]; | ||
}; | ||
|
||
export type ColumnAdditions = { [tableName: string]: { [columnName: string]: AddColumnPayload['column'] } }; | ||
|
||
export type ColumnEdits = { [tableName: string]: { [columnName: string]: AddColumnPayload['column'] } }; |