mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
update table schema doc path
This commit is contained in:
@@ -122,7 +122,7 @@ export default function TableSettingsDialog({
|
||||
};
|
||||
|
||||
const handleResetStructure = async () => {
|
||||
const schemaDocRef = db.doc(`_rowy_/settings/schema/${data!.collection}`);
|
||||
const schemaDocRef = db.doc(`_rowy_/settings/table/${data!.collection}`);
|
||||
await schemaDocRef.update({ columns: {} });
|
||||
handleClose();
|
||||
};
|
||||
|
||||
@@ -24,9 +24,7 @@ export default function Settings({ handleChange, config }: ISettingsProps) {
|
||||
{ value: string; label: string; type: FieldType }[]
|
||||
>([]);
|
||||
const getColumns = async (table) => {
|
||||
const tableConfigDoc = await db
|
||||
.doc(`_rowy_/settings/schema/${table}`)
|
||||
.get();
|
||||
const tableConfigDoc = await db.doc(`_rowy_/settings/table/${table}`).get();
|
||||
const tableConfig = tableConfigDoc.data();
|
||||
if (tableConfig && tableConfig.columns)
|
||||
setColumns(
|
||||
|
||||
@@ -80,7 +80,7 @@ const useSettings = () => {
|
||||
),
|
||||
//update the rowy collection doc with empty columns
|
||||
db
|
||||
.collection("_rowy_/settings/schema")
|
||||
.collection("_rowy_/settings/table")
|
||||
.doc(data.collection)
|
||||
.set({ ...data }, { merge: true }),
|
||||
]);
|
||||
@@ -91,7 +91,7 @@ const useSettings = () => {
|
||||
db.doc("_rowy_/settings").update({
|
||||
tables: tables.filter((table) => table.collection !== collection),
|
||||
});
|
||||
db.collection("_rowy_/settings/schema").doc(collection).delete();
|
||||
db.collection("_rowy_/settings/table").doc(collection).delete();
|
||||
};
|
||||
const settingsActions = { createTable, updateTable, deleteTable };
|
||||
return [settingsState, settingsActions];
|
||||
|
||||
Reference in New Issue
Block a user