🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

@payloadcms/db-sqlite

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@payloadcms/db-sqlite - npm Package Compare versions

Comparing version

to
3.0.0-canary.b8dd0db

@@ -39,2 +39,3 @@ import { createClient } from '@libsql/client';

}
if (typeof this.resolveInitializing === 'function') this.resolveInitializing();
if (process.env.NODE_ENV === 'production' && this.prodMigrations) {

@@ -45,5 +46,4 @@ await this.migrate({

}
if (typeof this.resolveInitializing === 'function') this.resolveInitializing();
};
//# sourceMappingURL=connect.js.map
import type { MigrationTemplateArgs } from 'payload';
export declare const indent: (text: string) => string;
export declare const getMigrationTemplate: ({ downSQL, imports, upSQL, }: MigrationTemplateArgs) => string;
//# sourceMappingURL=getMigrationTemplate.d.ts.map

@@ -0,9 +1,10 @@

export const indent = (text)=>text.split('\n').map((line)=>` ${line}`).join('\n');
export const getMigrationTemplate = ({ downSQL, imports, upSQL })=>`import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-sqlite'
${imports ? `${imports}\n` : ''}
export async function up({ payload, req }: MigrateUpArgs): Promise<void> {
${upSQL}
${indent(upSQL)}
}
export async function down({ payload, req }: MigrateDownArgs): Promise<void> {
${downSQL}
${indent(downSQL)}
}

@@ -10,0 +11,0 @@ `;

@@ -51,2 +51,3 @@ import { beginTransaction, commitTransaction, count, create, createGlobal, createGlobalVersion, createVersion, deleteMany, deleteOne, deleteVersions, destroy, find, findGlobal, findGlobalVersions, findMigrationDir, findOne, findVersions, migrate, migrateDown, migrateFresh, migrateRefresh, migrateReset, migrateStatus, operatorMap, queryDrafts, rollbackTransaction, updateGlobal, updateGlobalVersion, updateOne, updateVersion } from '@payloadcms/drizzle';

operators,
prodMigrations: args.prodMigrations,
push: args.push,

@@ -97,2 +98,3 @@ relations: {},

migrationDir,
packageName: '@payloadcms/db-sqlite',
payload,

@@ -99,0 +101,0 @@ queryDrafts,

@@ -1,2 +0,3 @@

/* eslint-disable no-param-reassign */ import { createTableName } from '@payloadcms/drizzle';
import { createTableName } from '@payloadcms/drizzle';
import { uniqueIndex } from 'drizzle-orm/sqlite-core';
import { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload';

@@ -26,2 +27,12 @@ import toSnakeCase from 'to-snake-case';

const tableName = this.tableNameMap.get(toSnakeCase(collection.slug));
const baseExtraConfig = {};
if (collection.upload.filenameCompoundIndex) {
const indexName = `${tableName}_filename_compound_idx`;
baseExtraConfig.filename_compound_index = (cols)=>{
const colsConstraint = collection.upload.filenameCompoundIndex.map((f)=>{
return cols[f];
});
return uniqueIndex(indexName).on(colsConstraint[0], ...colsConstraint.slice(1));
};
}
buildTable({

@@ -28,0 +39,0 @@ adapter: this,

@@ -15,2 +15,6 @@ import type { AnySQLiteColumn, ForeignKeyBuilder, IndexBuilder, SQLiteColumnBuilder, UniqueConstraintBuilder } from 'drizzle-orm/sqlite-core';

baseColumns?: Record<string, SQLiteColumnBuilder>;
/**
* After table is created, run these functions to add extra config to the table
* ie. indexes, multiple columns, etc
*/
baseExtraConfig?: BaseExtraConfig;

@@ -17,0 +21,0 @@ buildNumbers?: boolean;

@@ -581,3 +581,3 @@ import { createTableName, hasLocalesTable, validateExistingBlockIsIdentical } from '@payloadcms/drizzle';

field.relationTo.forEach((relation)=>relationships.add(relation));
} else if (field.type === 'relationship' && field.hasMany) {
} else if (field.hasMany) {
relationships.add(field.relationTo);

@@ -584,0 +584,0 @@ } else {

@@ -15,2 +15,7 @@ import type { Client, Config, ResultSet } from '@libsql/client';

migrationDir?: string;
prodMigrations?: {
down: (args: MigrateDownArgs) => Promise<void>;
name: string;
up: (args: MigrateUpArgs) => Promise<void>;
}[];
push?: boolean;

@@ -79,2 +84,7 @@ relationshipsSuffix?: string;

operators: Operators;
prodMigrations?: {
down: (args: MigrateDownArgs) => Promise<void>;
name: string;
up: (args: MigrateUpArgs) => Promise<void>;
}[];
push: boolean;

@@ -114,2 +124,7 @@ rejectInitializing: () => void;

logger: DrizzleConfig['logger'];
prodMigrations?: {
down: (args: MigrateDownArgs) => Promise<void>;
name: string;
up: (args: MigrateUpArgs) => Promise<void>;
}[];
push: boolean;

@@ -116,0 +131,0 @@ rejectInitializing: () => void;

{
"name": "@payloadcms/db-sqlite",
"version": "3.0.0-canary.b6520aa",
"version": "3.0.0-canary.b8dd0db",
"description": "The officially supported SQLite database adapter for Payload",

@@ -40,3 +40,3 @@ "homepage": "https://payloadcms.com",

"console-table-printer": "2.11.2",
"drizzle-kit": "0.23.2",
"drizzle-kit": "0.23.2-df9e596",
"drizzle-orm": "0.32.1",

@@ -46,3 +46,3 @@ "prompts": "2.4.2",

"uuid": "9.0.0",
"@payloadcms/drizzle": "3.0.0-canary.b6520aa"
"@payloadcms/drizzle": "3.0.0-canary.b8dd0db"
},

@@ -53,6 +53,6 @@ "devDependencies": {

"@payloadcms/eslint-config": "3.0.0-beta.59",
"payload": "3.0.0-canary.b6520aa"
"payload": "3.0.0-canary.b8dd0db"
},
"peerDependencies": {
"payload": "3.0.0-canary.b6520aa"
"payload": "3.0.0-canary.b8dd0db"
},

@@ -59,0 +59,0 @@ "scripts": {

@@ -1,2 +0,2 @@

# Payload Postgres Adapter
# Payload SQLite Adapter

@@ -3,0 +3,0 @@ Official SQLite adapter for [Payload](https://payloadcms.com).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet