@boltapp/bolt-app-db 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/client/schema/app-schema.d.ts +409 -0
- package/dist/client/schema/app-schema.js +59 -0
- package/dist/client/schema/data-store-schema.d.ts +236 -0
- package/dist/client/schema/data-store-schema.js +29 -0
- package/dist/client/schema/file-schema.d.ts +324 -0
- package/dist/client/schema/file-schema.js +31 -0
- package/dist/client/schema/index.d.ts +5 -0
- package/dist/client/schema/index.js +5 -0
- package/dist/client/schema/project-schema.d.ts +156 -0
- package/dist/client/schema/project-schema.js +17 -0
- package/dist/client/schema/table-schema.d.ts +890 -0
- package/dist/client/schema/table-schema.js +99 -0
- package/dist/cloud-app/schema/data-store-schemas.d.ts +220 -0
- package/dist/cloud-app/schema/data-store-schemas.js +32 -0
- package/dist/cloud-app/schema/data-table-schemas.d.ts +839 -0
- package/dist/cloud-app/schema/data-table-schemas.js +103 -0
- package/dist/cloud-app/schema/file-schemas.d.ts +300 -0
- package/dist/cloud-app/schema/file-schemas.js +37 -0
- package/dist/cloud-app/schema/index.d.ts +4 -0
- package/dist/cloud-app/schema/index.js +4 -0
- package/dist/cloud-app/schema/schema.d.ts +379 -0
- package/dist/cloud-app/schema/schema.js +48 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +49 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { TABLE_VIEW_DISPLAY_TYPES } from "@boltapp/bolt-core/data-table/schemas/views/display";
|
|
2
|
+
import { ACTION_TYPES } from "@boltapp/bolt-core/data-table/table-action-schemas";
|
|
3
|
+
import { relations } from "drizzle-orm";
|
|
4
|
+
import { boolean, index, integer, jsonb, pgEnum, pgTable, serial, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
|
|
5
|
+
import { nanoid } from "nanoid";
|
|
6
|
+
import { projects } from "./schema";
|
|
7
|
+
export const boltTableDisplayEnum = pgEnum("bolt_table_display", TABLE_VIEW_DISPLAY_TYPES);
|
|
8
|
+
export const boltTableOpSourceEnum = pgEnum("bolt_table_op_source", ["client", "api", "server"]);
|
|
9
|
+
export const boltTableOpTypeEnum = pgEnum("bolt_table_op_type", ACTION_TYPES);
|
|
10
|
+
export const boltTables = pgTable("bolt_tables", {
|
|
11
|
+
id: text("id")
|
|
12
|
+
.primaryKey()
|
|
13
|
+
.$defaultFn(() => nanoid()),
|
|
14
|
+
name: text("name").notNull(),
|
|
15
|
+
label: text("label").default("Untitled Table").notNull(),
|
|
16
|
+
description: text("description"),
|
|
17
|
+
idField: text("id_field").default("id").notNull(),
|
|
18
|
+
displayColumn: text("display_column").notNull(),
|
|
19
|
+
columns: jsonb("columns").$type(),
|
|
20
|
+
rows: jsonb("rows").$type(),
|
|
21
|
+
projectId: text("project_id")
|
|
22
|
+
.notNull()
|
|
23
|
+
.references(() => projects.id, { onDelete: "cascade" }),
|
|
24
|
+
organizationId: text("organization_id"),
|
|
25
|
+
createdBy: text("created_by").default("system").notNull(),
|
|
26
|
+
updatedBy: text("updated_by").default("system").notNull(),
|
|
27
|
+
createdAt: timestamp("created_at").defaultNow(),
|
|
28
|
+
updatedAt: timestamp("updated_at").defaultNow(),
|
|
29
|
+
}, (table) => [
|
|
30
|
+
uniqueIndex("bolt_tables_project_name_unique_idx").on(table.projectId, table.name),
|
|
31
|
+
index("bolt_tables_project_idx").on(table.projectId),
|
|
32
|
+
index("bolt_tables_organization_idx").on(table.organizationId),
|
|
33
|
+
]);
|
|
34
|
+
export const boltTableViews = pgTable("bolt_table_views", {
|
|
35
|
+
id: text("id")
|
|
36
|
+
.primaryKey()
|
|
37
|
+
.$defaultFn(() => nanoid()),
|
|
38
|
+
name: text("name").notNull(),
|
|
39
|
+
label: text("label").default("Untitled View").notNull(),
|
|
40
|
+
tableId: text("table_id")
|
|
41
|
+
.notNull()
|
|
42
|
+
.references(() => boltTables.id, { onDelete: "cascade" }),
|
|
43
|
+
description: text("description"),
|
|
44
|
+
display: boltTableDisplayEnum("display").default("table").notNull(),
|
|
45
|
+
visibleColumnIds: jsonb("visible_column_ids").$type().notNull(),
|
|
46
|
+
sorting: jsonb("sorting").$type(),
|
|
47
|
+
showRowNumbers: boolean("show_row_numbers"),
|
|
48
|
+
rowHeight: integer("row_height"),
|
|
49
|
+
displayConfig: jsonb("display_config").$type().notNull(),
|
|
50
|
+
projectId: text("project_id").references(() => projects.id, { onDelete: "cascade" }),
|
|
51
|
+
organizationId: text("organization_id"),
|
|
52
|
+
createdBy: text("created_by"),
|
|
53
|
+
createdAt: timestamp("created_at").defaultNow(),
|
|
54
|
+
updatedAt: timestamp("updated_at").defaultNow(),
|
|
55
|
+
}, (table) => [
|
|
56
|
+
index("bolt_table_views_table_id_idx").on(table.tableId),
|
|
57
|
+
index("bolt_table_views_project_idx").on(table.projectId),
|
|
58
|
+
]);
|
|
59
|
+
export const boltTableOps = pgTable("bolt_table_ops", {
|
|
60
|
+
id: text("id")
|
|
61
|
+
.notNull()
|
|
62
|
+
.$defaultFn(() => nanoid()),
|
|
63
|
+
serverSeq: serial("server_seq").primaryKey(),
|
|
64
|
+
clientActionId: text("client_action_id"),
|
|
65
|
+
type: boltTableOpTypeEnum("type").notNull(),
|
|
66
|
+
rowId: text("row_id"),
|
|
67
|
+
colId: text("col_id"),
|
|
68
|
+
tableId: text("table_id")
|
|
69
|
+
.notNull()
|
|
70
|
+
.references(() => boltTables.id, { onDelete: "cascade" }),
|
|
71
|
+
source: boltTableOpSourceEnum("source").default("server").notNull(),
|
|
72
|
+
payload: jsonb("payload").$type().notNull(),
|
|
73
|
+
basisRowVersion: integer("basis_row_version"),
|
|
74
|
+
basisTableVersion: integer("basis_table_version"),
|
|
75
|
+
userId: text("user_id").notNull(),
|
|
76
|
+
createdAt: timestamp("created_at").defaultNow(),
|
|
77
|
+
}, (table) => [
|
|
78
|
+
index("bolt_table_ops_table_seq_idx").on(table.tableId, table.serverSeq),
|
|
79
|
+
index("bolt_table_ops_table_idx").on(table.tableId),
|
|
80
|
+
index("bolt_table_ops_row_idx").on(table.rowId),
|
|
81
|
+
index("bolt_table_ops_col_idx").on(table.colId),
|
|
82
|
+
index("bolt_table_ops_type_idx").on(table.type),
|
|
83
|
+
]);
|
|
84
|
+
export const boltTablesRelations = relations(boltTables, ({ many, one }) => ({
|
|
85
|
+
views: many(boltTableViews),
|
|
86
|
+
ops: many(boltTableOps),
|
|
87
|
+
project: one(projects, {
|
|
88
|
+
fields: [boltTables.projectId],
|
|
89
|
+
references: [projects.id],
|
|
90
|
+
}),
|
|
91
|
+
}));
|
|
92
|
+
export const boltTableViewsRelations = relations(boltTableViews, ({ one }) => ({
|
|
93
|
+
table: one(boltTables, {
|
|
94
|
+
fields: [boltTableViews.tableId],
|
|
95
|
+
references: [boltTables.id],
|
|
96
|
+
}),
|
|
97
|
+
}));
|
|
98
|
+
export const boltTableOpsRelations = relations(boltTableOps, ({ one }) => ({
|
|
99
|
+
table: one(boltTables, {
|
|
100
|
+
fields: [boltTableOps.tableId],
|
|
101
|
+
references: [boltTables.id],
|
|
102
|
+
}),
|
|
103
|
+
}));
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
export declare const boltFiles: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2
|
+
name: "bolt_files";
|
|
3
|
+
schema: undefined;
|
|
4
|
+
columns: {
|
|
5
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
6
|
+
name: "id";
|
|
7
|
+
tableName: "bolt_files";
|
|
8
|
+
dataType: "string";
|
|
9
|
+
columnType: "PgText";
|
|
10
|
+
data: string;
|
|
11
|
+
driverParam: string;
|
|
12
|
+
notNull: true;
|
|
13
|
+
hasDefault: true;
|
|
14
|
+
isPrimaryKey: true;
|
|
15
|
+
isAutoincrement: false;
|
|
16
|
+
hasRuntimeDefault: true;
|
|
17
|
+
enumValues: [string, ...string[]];
|
|
18
|
+
baseColumn: never;
|
|
19
|
+
identity: undefined;
|
|
20
|
+
generated: undefined;
|
|
21
|
+
}, {}, {}>;
|
|
22
|
+
appId: import("drizzle-orm/pg-core").PgColumn<{
|
|
23
|
+
name: "app_id";
|
|
24
|
+
tableName: "bolt_files";
|
|
25
|
+
dataType: "string";
|
|
26
|
+
columnType: "PgText";
|
|
27
|
+
data: string;
|
|
28
|
+
driverParam: string;
|
|
29
|
+
notNull: true;
|
|
30
|
+
hasDefault: false;
|
|
31
|
+
isPrimaryKey: false;
|
|
32
|
+
isAutoincrement: false;
|
|
33
|
+
hasRuntimeDefault: false;
|
|
34
|
+
enumValues: [string, ...string[]];
|
|
35
|
+
baseColumn: never;
|
|
36
|
+
identity: undefined;
|
|
37
|
+
generated: undefined;
|
|
38
|
+
}, {}, {}>;
|
|
39
|
+
organizationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
40
|
+
name: "organization_id";
|
|
41
|
+
tableName: "bolt_files";
|
|
42
|
+
dataType: "string";
|
|
43
|
+
columnType: "PgText";
|
|
44
|
+
data: string;
|
|
45
|
+
driverParam: string;
|
|
46
|
+
notNull: false;
|
|
47
|
+
hasDefault: false;
|
|
48
|
+
isPrimaryKey: false;
|
|
49
|
+
isAutoincrement: false;
|
|
50
|
+
hasRuntimeDefault: false;
|
|
51
|
+
enumValues: [string, ...string[]];
|
|
52
|
+
baseColumn: never;
|
|
53
|
+
identity: undefined;
|
|
54
|
+
generated: undefined;
|
|
55
|
+
}, {}, {}>;
|
|
56
|
+
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
57
|
+
name: "name";
|
|
58
|
+
tableName: "bolt_files";
|
|
59
|
+
dataType: "string";
|
|
60
|
+
columnType: "PgText";
|
|
61
|
+
data: string;
|
|
62
|
+
driverParam: string;
|
|
63
|
+
notNull: true;
|
|
64
|
+
hasDefault: false;
|
|
65
|
+
isPrimaryKey: false;
|
|
66
|
+
isAutoincrement: false;
|
|
67
|
+
hasRuntimeDefault: false;
|
|
68
|
+
enumValues: [string, ...string[]];
|
|
69
|
+
baseColumn: never;
|
|
70
|
+
identity: undefined;
|
|
71
|
+
generated: undefined;
|
|
72
|
+
}, {}, {}>;
|
|
73
|
+
url: import("drizzle-orm/pg-core").PgColumn<{
|
|
74
|
+
name: "url";
|
|
75
|
+
tableName: "bolt_files";
|
|
76
|
+
dataType: "string";
|
|
77
|
+
columnType: "PgText";
|
|
78
|
+
data: string;
|
|
79
|
+
driverParam: string;
|
|
80
|
+
notNull: true;
|
|
81
|
+
hasDefault: false;
|
|
82
|
+
isPrimaryKey: false;
|
|
83
|
+
isAutoincrement: false;
|
|
84
|
+
hasRuntimeDefault: false;
|
|
85
|
+
enumValues: [string, ...string[]];
|
|
86
|
+
baseColumn: never;
|
|
87
|
+
identity: undefined;
|
|
88
|
+
generated: undefined;
|
|
89
|
+
}, {}, {}>;
|
|
90
|
+
mimeType: import("drizzle-orm/pg-core").PgColumn<{
|
|
91
|
+
name: "mime_type";
|
|
92
|
+
tableName: "bolt_files";
|
|
93
|
+
dataType: "string";
|
|
94
|
+
columnType: "PgText";
|
|
95
|
+
data: string;
|
|
96
|
+
driverParam: string;
|
|
97
|
+
notNull: true;
|
|
98
|
+
hasDefault: false;
|
|
99
|
+
isPrimaryKey: false;
|
|
100
|
+
isAutoincrement: false;
|
|
101
|
+
hasRuntimeDefault: false;
|
|
102
|
+
enumValues: [string, ...string[]];
|
|
103
|
+
baseColumn: never;
|
|
104
|
+
identity: undefined;
|
|
105
|
+
generated: undefined;
|
|
106
|
+
}, {}, {}>;
|
|
107
|
+
extension: import("drizzle-orm/pg-core").PgColumn<{
|
|
108
|
+
name: "extension";
|
|
109
|
+
tableName: "bolt_files";
|
|
110
|
+
dataType: "string";
|
|
111
|
+
columnType: "PgText";
|
|
112
|
+
data: string;
|
|
113
|
+
driverParam: string;
|
|
114
|
+
notNull: false;
|
|
115
|
+
hasDefault: false;
|
|
116
|
+
isPrimaryKey: false;
|
|
117
|
+
isAutoincrement: false;
|
|
118
|
+
hasRuntimeDefault: false;
|
|
119
|
+
enumValues: [string, ...string[]];
|
|
120
|
+
baseColumn: never;
|
|
121
|
+
identity: undefined;
|
|
122
|
+
generated: undefined;
|
|
123
|
+
}, {}, {}>;
|
|
124
|
+
size: import("drizzle-orm/pg-core").PgColumn<{
|
|
125
|
+
name: "size";
|
|
126
|
+
tableName: "bolt_files";
|
|
127
|
+
dataType: "number";
|
|
128
|
+
columnType: "PgInteger";
|
|
129
|
+
data: number;
|
|
130
|
+
driverParam: string | number;
|
|
131
|
+
notNull: false;
|
|
132
|
+
hasDefault: false;
|
|
133
|
+
isPrimaryKey: false;
|
|
134
|
+
isAutoincrement: false;
|
|
135
|
+
hasRuntimeDefault: false;
|
|
136
|
+
enumValues: undefined;
|
|
137
|
+
baseColumn: never;
|
|
138
|
+
identity: undefined;
|
|
139
|
+
generated: undefined;
|
|
140
|
+
}, {}, {}>;
|
|
141
|
+
width: import("drizzle-orm/pg-core").PgColumn<{
|
|
142
|
+
name: "width";
|
|
143
|
+
tableName: "bolt_files";
|
|
144
|
+
dataType: "number";
|
|
145
|
+
columnType: "PgInteger";
|
|
146
|
+
data: number;
|
|
147
|
+
driverParam: string | number;
|
|
148
|
+
notNull: false;
|
|
149
|
+
hasDefault: false;
|
|
150
|
+
isPrimaryKey: false;
|
|
151
|
+
isAutoincrement: false;
|
|
152
|
+
hasRuntimeDefault: false;
|
|
153
|
+
enumValues: undefined;
|
|
154
|
+
baseColumn: never;
|
|
155
|
+
identity: undefined;
|
|
156
|
+
generated: undefined;
|
|
157
|
+
}, {}, {}>;
|
|
158
|
+
height: import("drizzle-orm/pg-core").PgColumn<{
|
|
159
|
+
name: "height";
|
|
160
|
+
tableName: "bolt_files";
|
|
161
|
+
dataType: "number";
|
|
162
|
+
columnType: "PgInteger";
|
|
163
|
+
data: number;
|
|
164
|
+
driverParam: string | number;
|
|
165
|
+
notNull: false;
|
|
166
|
+
hasDefault: false;
|
|
167
|
+
isPrimaryKey: false;
|
|
168
|
+
isAutoincrement: false;
|
|
169
|
+
hasRuntimeDefault: false;
|
|
170
|
+
enumValues: undefined;
|
|
171
|
+
baseColumn: never;
|
|
172
|
+
identity: undefined;
|
|
173
|
+
generated: undefined;
|
|
174
|
+
}, {}, {}>;
|
|
175
|
+
alt: import("drizzle-orm/pg-core").PgColumn<{
|
|
176
|
+
name: "alt";
|
|
177
|
+
tableName: "bolt_files";
|
|
178
|
+
dataType: "string";
|
|
179
|
+
columnType: "PgText";
|
|
180
|
+
data: string;
|
|
181
|
+
driverParam: string;
|
|
182
|
+
notNull: false;
|
|
183
|
+
hasDefault: false;
|
|
184
|
+
isPrimaryKey: false;
|
|
185
|
+
isAutoincrement: false;
|
|
186
|
+
hasRuntimeDefault: false;
|
|
187
|
+
enumValues: [string, ...string[]];
|
|
188
|
+
baseColumn: never;
|
|
189
|
+
identity: undefined;
|
|
190
|
+
generated: undefined;
|
|
191
|
+
}, {}, {}>;
|
|
192
|
+
source: import("drizzle-orm/pg-core").PgColumn<{
|
|
193
|
+
name: "source";
|
|
194
|
+
tableName: "bolt_files";
|
|
195
|
+
dataType: "string";
|
|
196
|
+
columnType: "PgText";
|
|
197
|
+
data: "local" | "remote";
|
|
198
|
+
driverParam: string;
|
|
199
|
+
notNull: false;
|
|
200
|
+
hasDefault: true;
|
|
201
|
+
isPrimaryKey: false;
|
|
202
|
+
isAutoincrement: false;
|
|
203
|
+
hasRuntimeDefault: false;
|
|
204
|
+
enumValues: ["local", "remote"];
|
|
205
|
+
baseColumn: never;
|
|
206
|
+
identity: undefined;
|
|
207
|
+
generated: undefined;
|
|
208
|
+
}, {}, {}>;
|
|
209
|
+
storagePath: import("drizzle-orm/pg-core").PgColumn<{
|
|
210
|
+
name: "storage_path";
|
|
211
|
+
tableName: "bolt_files";
|
|
212
|
+
dataType: "string";
|
|
213
|
+
columnType: "PgText";
|
|
214
|
+
data: string;
|
|
215
|
+
driverParam: string;
|
|
216
|
+
notNull: true;
|
|
217
|
+
hasDefault: false;
|
|
218
|
+
isPrimaryKey: false;
|
|
219
|
+
isAutoincrement: false;
|
|
220
|
+
hasRuntimeDefault: false;
|
|
221
|
+
enumValues: [string, ...string[]];
|
|
222
|
+
baseColumn: never;
|
|
223
|
+
identity: undefined;
|
|
224
|
+
generated: undefined;
|
|
225
|
+
}, {}, {}>;
|
|
226
|
+
createdBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
227
|
+
name: "created_by";
|
|
228
|
+
tableName: "bolt_files";
|
|
229
|
+
dataType: "string";
|
|
230
|
+
columnType: "PgText";
|
|
231
|
+
data: string;
|
|
232
|
+
driverParam: string;
|
|
233
|
+
notNull: true;
|
|
234
|
+
hasDefault: true;
|
|
235
|
+
isPrimaryKey: false;
|
|
236
|
+
isAutoincrement: false;
|
|
237
|
+
hasRuntimeDefault: false;
|
|
238
|
+
enumValues: [string, ...string[]];
|
|
239
|
+
baseColumn: never;
|
|
240
|
+
identity: undefined;
|
|
241
|
+
generated: undefined;
|
|
242
|
+
}, {}, {}>;
|
|
243
|
+
updatedBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
244
|
+
name: "updated_by";
|
|
245
|
+
tableName: "bolt_files";
|
|
246
|
+
dataType: "string";
|
|
247
|
+
columnType: "PgText";
|
|
248
|
+
data: string;
|
|
249
|
+
driverParam: string;
|
|
250
|
+
notNull: false;
|
|
251
|
+
hasDefault: true;
|
|
252
|
+
isPrimaryKey: false;
|
|
253
|
+
isAutoincrement: false;
|
|
254
|
+
hasRuntimeDefault: false;
|
|
255
|
+
enumValues: [string, ...string[]];
|
|
256
|
+
baseColumn: never;
|
|
257
|
+
identity: undefined;
|
|
258
|
+
generated: undefined;
|
|
259
|
+
}, {}, {}>;
|
|
260
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
261
|
+
name: "created_at";
|
|
262
|
+
tableName: "bolt_files";
|
|
263
|
+
dataType: "date";
|
|
264
|
+
columnType: "PgTimestamp";
|
|
265
|
+
data: Date;
|
|
266
|
+
driverParam: string;
|
|
267
|
+
notNull: false;
|
|
268
|
+
hasDefault: true;
|
|
269
|
+
isPrimaryKey: false;
|
|
270
|
+
isAutoincrement: false;
|
|
271
|
+
hasRuntimeDefault: false;
|
|
272
|
+
enumValues: undefined;
|
|
273
|
+
baseColumn: never;
|
|
274
|
+
identity: undefined;
|
|
275
|
+
generated: undefined;
|
|
276
|
+
}, {}, {}>;
|
|
277
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
278
|
+
name: "updated_at";
|
|
279
|
+
tableName: "bolt_files";
|
|
280
|
+
dataType: "date";
|
|
281
|
+
columnType: "PgTimestamp";
|
|
282
|
+
data: Date;
|
|
283
|
+
driverParam: string;
|
|
284
|
+
notNull: false;
|
|
285
|
+
hasDefault: true;
|
|
286
|
+
isPrimaryKey: false;
|
|
287
|
+
isAutoincrement: false;
|
|
288
|
+
hasRuntimeDefault: false;
|
|
289
|
+
enumValues: undefined;
|
|
290
|
+
baseColumn: never;
|
|
291
|
+
identity: undefined;
|
|
292
|
+
generated: undefined;
|
|
293
|
+
}, {}, {}>;
|
|
294
|
+
};
|
|
295
|
+
dialect: "pg";
|
|
296
|
+
}>;
|
|
297
|
+
export declare const boltFilesRelations: import("drizzle-orm").Relations<"bolt_files", {
|
|
298
|
+
app: import("drizzle-orm").One<"apps", true>;
|
|
299
|
+
}>;
|
|
300
|
+
export type BoltFileCloud = typeof boltFiles.$inferSelect;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { relations } from "drizzle-orm";
|
|
2
|
+
import { index, integer, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
3
|
+
import { nanoid } from "nanoid";
|
|
4
|
+
import { apps } from "./schema";
|
|
5
|
+
export const boltFiles = pgTable("bolt_files", {
|
|
6
|
+
id: text("id")
|
|
7
|
+
.primaryKey()
|
|
8
|
+
.$defaultFn(() => nanoid()),
|
|
9
|
+
appId: text("app_id")
|
|
10
|
+
.notNull()
|
|
11
|
+
.references(() => apps.id, { onDelete: "cascade" }),
|
|
12
|
+
organizationId: text("organization_id"),
|
|
13
|
+
name: text("name").notNull(),
|
|
14
|
+
url: text("url").notNull(),
|
|
15
|
+
mimeType: text("mime_type").notNull(),
|
|
16
|
+
extension: text("extension"),
|
|
17
|
+
size: integer("size"),
|
|
18
|
+
width: integer("width"),
|
|
19
|
+
height: integer("height"),
|
|
20
|
+
alt: text("alt"),
|
|
21
|
+
source: text("source", { enum: ["local", "remote"] }).default("local"),
|
|
22
|
+
storagePath: text("storage_path").notNull(),
|
|
23
|
+
createdBy: text("created_by").default("system").notNull(),
|
|
24
|
+
updatedBy: text("updated_by").default("system"),
|
|
25
|
+
createdAt: timestamp("created_at").defaultNow(),
|
|
26
|
+
updatedAt: timestamp("updated_at").defaultNow(),
|
|
27
|
+
}, (table) => [
|
|
28
|
+
index("bolt_files_app_idx").on(table.appId),
|
|
29
|
+
index("bolt_files_org_idx").on(table.organizationId),
|
|
30
|
+
index("bolt_files_name_idx").on(table.name),
|
|
31
|
+
]);
|
|
32
|
+
export const boltFilesRelations = relations(boltFiles, ({ one }) => ({
|
|
33
|
+
app: one(apps, {
|
|
34
|
+
fields: [boltFiles.appId],
|
|
35
|
+
references: [apps.id],
|
|
36
|
+
}),
|
|
37
|
+
}));
|