@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
76 lines (75 loc) • 2.85 kB
JavaScript
/*
* Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>
* This file is part of Sync-in | The open source file sync and share solution
* See the LICENSE file for licensing details
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "syncPaths", {
enumerable: true,
get: function() {
return syncPaths;
}
});
const _drizzleorm = require("drizzle-orm");
const _mysqlcore = require("drizzle-orm/mysql-core");
const _filesschema = require("../../files/schemas/files.schema");
const _sharesschema = require("../../shares/schemas/shares.schema");
const _spacesrootsschema = require("../../spaces/schemas/spaces-roots.schema");
const _spacesschema = require("../../spaces/schemas/spaces.schema");
const _usersschema = require("../../users/schemas/users.schema");
const _syncclientsschema = require("./sync-clients.schema");
const syncPaths = (0, _mysqlcore.mysqlTable)('sync_paths', {
id: (0, _mysqlcore.bigint)('id', {
mode: 'number',
unsigned: true
}).autoincrement().primaryKey(),
clientId: (0, _mysqlcore.char)('clientId', {
length: 36
}).references(()=>_syncclientsschema.syncClients.id, {
onDelete: 'cascade'
}).notNull(),
ownerId: (0, _mysqlcore.bigint)('ownerId', {
mode: 'number',
unsigned: true
}).references(()=>_usersschema.users.id, {
onDelete: 'cascade'
}),
spaceId: (0, _mysqlcore.bigint)('spaceId', {
mode: 'number',
unsigned: true
}).references(()=>_spacesschema.spaces.id, {
onDelete: 'cascade'
}),
spaceRootId: (0, _mysqlcore.bigint)('spaceRootId', {
mode: 'number',
unsigned: true
}).references(()=>_spacesrootsschema.spacesRoots.id, {
onDelete: 'cascade'
}),
shareId: (0, _mysqlcore.bigint)('shareId', {
mode: 'number',
unsigned: true
}).references(()=>_sharesschema.shares.id, {
onDelete: 'cascade'
}),
fileId: (0, _mysqlcore.bigint)('fileId', {
mode: 'number',
unsigned: true
}).references(()=>_filesschema.files.id, {
onDelete: 'cascade'
}),
settings: (0, _mysqlcore.json)('settings').$type().notNull(),
createdAt: (0, _mysqlcore.datetime)('createdAt', {
mode: 'date'
}).default((0, _drizzleorm.sql)`CURRENT_TIMESTAMP`).notNull()
}, (table)=>[
(0, _mysqlcore.index)('client_idx').on(table.clientId),
(0, _mysqlcore.index)('owner_idx').on(table.ownerId),
(0, _mysqlcore.index)('space_idx').on(table.spaceId),
(0, _mysqlcore.index)('space_root_idx').on(table.spaceRootId),
(0, _mysqlcore.index)('share_idx').on(table.shareId),
(0, _mysqlcore.index)('file_idx').on(table.fileId)
]);
//# sourceMappingURL=sync-paths.schema.js.map