@payloadcms/db-sqlite
Advanced tools
Comparing version
@@ -17,3 +17,3 @@ import fs from 'fs'; | ||
} | ||
const { generateSQLiteDrizzleJson, generateSQLiteMigration } = require('drizzle-kit/payload'); | ||
const { generateSQLiteDrizzleJson, generateSQLiteMigration } = require('drizzle-kit/api'); | ||
const drizzleJsonAfter = await generateSQLiteDrizzleJson(this.schema); | ||
@@ -20,0 +20,0 @@ const [yyymmdd, hhmmss] = new Date().toISOString().split('T'); |
@@ -1,3 +0,3 @@ | ||
import type { DrizzleSQLiteSnapshotJSON } from 'drizzle-kit/payload'; | ||
import type { DrizzleSQLiteSnapshotJSON } from 'drizzle-kit/api'; | ||
export declare const defaultDrizzleSnapshot: DrizzleSQLiteSnapshotJSON; | ||
//# sourceMappingURL=defaultSnapshot.d.ts.map |
@@ -11,5 +11,5 @@ export const defaultDrizzleSnapshot = { | ||
tables: {}, | ||
version: '5' | ||
version: '6' | ||
}; | ||
//# sourceMappingURL=defaultSnapshot.js.map |
@@ -62,3 +62,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'; | ||
// DatabaseAdapter | ||
beginTransaction: args.transactionOptions === false ? undefined : beginTransaction, | ||
beginTransaction: args.transactionOptions ? beginTransaction : undefined, | ||
commitTransaction, | ||
@@ -65,0 +65,0 @@ connect, |
@@ -6,3 +6,3 @@ import { createRequire } from 'module'; | ||
*/ export const requireDrizzleKit = ()=>{ | ||
const { generateSQLiteDrizzleJson: generateDrizzleJson, pushSQLiteSchema: pushSchema } = require('drizzle-kit/payload'); | ||
const { generateSQLiteDrizzleJson: generateDrizzleJson, pushSQLiteSchema: pushSchema } = require('drizzle-kit/api'); | ||
return { | ||
@@ -9,0 +9,0 @@ generateDrizzleJson, |
@@ -1,18 +0,6 @@ | ||
import type { ColumnDataType } from 'drizzle-orm'; | ||
import type { ForeignKeyBuilder, IndexBuilder, SQLiteColumn, SQLiteColumnBuilder, UniqueConstraintBuilder } from 'drizzle-orm/sqlite-core'; | ||
import type { AnySQLiteColumn, ForeignKeyBuilder, IndexBuilder, SQLiteColumnBuilder, UniqueConstraintBuilder } from 'drizzle-orm/sqlite-core'; | ||
import type { Field } from 'payload'; | ||
import type { IDType, SQLiteAdapter } from '../types.js'; | ||
export type BaseExtraConfig = Record<string, (cols: { | ||
[x: string]: SQLiteColumn<{ | ||
baseColumn: never; | ||
columnType: string; | ||
data: unknown; | ||
dataType: ColumnDataType; | ||
driverParam: unknown; | ||
enumValues: string[]; | ||
hasDefault: false; | ||
name: string; | ||
notNull: false; | ||
tableName: string; | ||
}>; | ||
[x: string]: AnySQLiteColumn; | ||
}) => ForeignKeyBuilder | IndexBuilder | UniqueConstraintBuilder>; | ||
@@ -19,0 +7,0 @@ export type RelationMap = Map<string, { |
@@ -1,2 +0,2 @@ | ||
/* eslint-disable no-param-reassign */ import { createTableName } from '@payloadcms/drizzle'; | ||
import { createTableName } from '@payloadcms/drizzle'; | ||
import { relations, sql } from 'drizzle-orm'; | ||
@@ -3,0 +3,0 @@ import { foreignKey, index, integer, numeric, sqliteTable, text, unique } from 'drizzle-orm/sqlite-core'; |
@@ -1,2 +0,2 @@ | ||
import type { GenericColumn } from '../types.js'; | ||
import type { AnySQLiteColumn } from 'drizzle-orm/sqlite-core'; | ||
type CreateIndexArgs = { | ||
@@ -9,5 +9,5 @@ columnName: string; | ||
export declare const createIndex: ({ name, columnName, tableName, unique }: CreateIndexArgs) => (table: { | ||
[x: string]: GenericColumn; | ||
[x: string]: AnySQLiteColumn; | ||
}) => import("drizzle-orm/sqlite-core").IndexBuilder; | ||
export {}; | ||
//# sourceMappingURL=createIndex.d.ts.map |
@@ -1,2 +0,2 @@ | ||
/* eslint-disable no-param-reassign */ import { index, uniqueIndex } from 'drizzle-orm/sqlite-core'; | ||
import { index, uniqueIndex } from 'drizzle-orm/sqlite-core'; | ||
export const createIndex = ({ name, columnName, tableName, unique })=>{ | ||
@@ -3,0 +3,0 @@ return (table)=>{ |
@@ -1,2 +0,2 @@ | ||
/* eslint-disable no-param-reassign */ import { createTableName, hasLocalesTable, validateExistingBlockIsIdentical } from '@payloadcms/drizzle'; | ||
import { createTableName, hasLocalesTable, validateExistingBlockIsIdentical } from '@payloadcms/drizzle'; | ||
import { relations } from 'drizzle-orm'; | ||
@@ -11,2 +11,3 @@ import { SQLiteIntegerBuilder, SQLiteNumericBuilder, SQLiteTextBuilder, foreignKey, index, integer, numeric, text } from 'drizzle-orm/sqlite-core'; | ||
import { idToUUID } from './idToUUID.js'; | ||
import { withDefault } from './withDefault.js'; | ||
export const traverseFields = ({ adapter, columnPrefix, columns, disableNotNull, disableUnique = false, fieldPrefix, fields, forceLocalized, indexes, locales, localesColumns, localesIndexes, newTableName, parentTableName, relationsToBuild, relationships, rootRelationsToBuild, rootTableIDColType, rootTableName, versions })=>{ | ||
@@ -79,3 +80,3 @@ let hasLocalizedField = false; | ||
} else { | ||
targetTable[fieldName] = text(columnName); | ||
targetTable[fieldName] = withDefault(text(columnName), field); | ||
} | ||
@@ -88,3 +89,3 @@ break; | ||
{ | ||
targetTable[fieldName] = text(columnName); | ||
targetTable[fieldName] = withDefault(text(columnName), field); | ||
break; | ||
@@ -107,3 +108,3 @@ } | ||
} else { | ||
targetTable[fieldName] = numeric(columnName); | ||
targetTable[fieldName] = withDefault(numeric(columnName), field); | ||
} | ||
@@ -115,5 +116,5 @@ break; | ||
{ | ||
targetTable[fieldName] = text(columnName, { | ||
targetTable[fieldName] = withDefault(text(columnName, { | ||
mode: 'json' | ||
}); | ||
}), field); | ||
break; | ||
@@ -123,3 +124,3 @@ } | ||
{ | ||
targetTable[fieldName] = text(columnName); | ||
targetTable[fieldName] = withDefault(text(columnName), field); | ||
break; | ||
@@ -211,5 +212,5 @@ } | ||
} else { | ||
targetTable[fieldName] = text(fieldName, { | ||
targetTable[fieldName] = withDefault(text(fieldName, { | ||
enum: options | ||
}); | ||
}), field); | ||
} | ||
@@ -220,5 +221,5 @@ break; | ||
{ | ||
targetTable[fieldName] = integer(columnName, { | ||
targetTable[fieldName] = withDefault(integer(columnName, { | ||
mode: 'boolean' | ||
}); | ||
}), field); | ||
break; | ||
@@ -225,0 +226,0 @@ } |
import type { Client, Config, ResultSet } from '@libsql/client'; | ||
import type { Operators } from '@payloadcms/drizzle'; | ||
import type { BuildQueryJoinAliases, DrizzleAdapter } from '@payloadcms/drizzle/types'; | ||
import type { ColumnDataType, DrizzleConfig, Relation, Relations, SQL } from 'drizzle-orm'; | ||
import type { DrizzleConfig, Relation, Relations, SQL } from 'drizzle-orm'; | ||
import type { LibSQLDatabase } from 'drizzle-orm/libsql'; | ||
import type { SQLiteColumn, SQLiteInsertOnConflictDoUpdateConfig, SQLiteTableWithColumns, SQLiteTransactionConfig } from 'drizzle-orm/sqlite-core'; | ||
import type { AnySQLiteColumn, SQLiteInsertOnConflictDoUpdateConfig, SQLiteTableWithColumns, SQLiteTransactionConfig } from 'drizzle-orm/sqlite-core'; | ||
import type { SQLiteRaw } from 'drizzle-orm/sqlite-core/query-builders/raw'; | ||
@@ -21,16 +21,4 @@ import type { Payload, PayloadRequest } from 'payload'; | ||
}; | ||
export type GenericColumn = SQLiteColumn<{ | ||
baseColumn: never; | ||
columnType: string; | ||
data: unknown; | ||
dataType: ColumnDataType; | ||
driverParam: unknown; | ||
enumValues: string[]; | ||
hasDefault: false; | ||
name: string; | ||
notNull: false; | ||
tableName: string; | ||
}, object>; | ||
export type GenericColumns = { | ||
[x: string]: GenericColumn; | ||
[x: string]: AnySQLiteColumn; | ||
}; | ||
@@ -114,2 +102,3 @@ export type GenericTable = SQLiteTableWithColumns<{ | ||
interface DatabaseAdapter extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>, DrizzleAdapter { | ||
beginTransaction: (options?: SQLiteTransactionConfig) => Promise<null | number | string>; | ||
drizzle: LibSQLDatabase; | ||
@@ -116,0 +105,0 @@ /** |
{ | ||
"name": "@payloadcms/db-sqlite", | ||
"version": "3.0.0-canary.6d066c2", | ||
"version": "3.0.0-canary.95fcd13", | ||
"description": "The officially supported SQLite database adapter for Payload", | ||
@@ -40,8 +40,8 @@ "homepage": "https://payloadcms.com", | ||
"console-table-printer": "2.11.2", | ||
"drizzle-kit": "0.20.14-1f2c838", | ||
"drizzle-orm": "0.29.4", | ||
"drizzle-kit": "0.23.2", | ||
"drizzle-orm": "0.32.1", | ||
"prompts": "2.4.2", | ||
"to-snake-case": "1.0.0", | ||
"uuid": "9.0.0", | ||
"@payloadcms/drizzle": "3.0.0-canary.6d066c2" | ||
"@payloadcms/drizzle": "3.0.0-canary.95fcd13" | ||
}, | ||
@@ -52,6 +52,6 @@ "devDependencies": { | ||
"@payloadcms/eslint-config": "3.0.0-beta.59", | ||
"payload": "3.0.0-canary.6d066c2" | ||
"payload": "3.0.0-canary.95fcd13" | ||
}, | ||
"peerDependencies": { | ||
"payload": "3.0.0-canary.6d066c2" | ||
"payload": "3.0.0-canary.95fcd13" | ||
}, | ||
@@ -58,0 +58,0 @@ "scripts": { |
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
Sorry, the diff of this file is not supported yet
217411
0.35%90
4.65%1853
-0.59%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated