drizzle-team/drizzle-orm · error · Error
Method not implemented.
Error message
Method not implemented.
What it means
SingleStoreDateTimeBuilder.generatedAlwaysAs() throws 'Method not implemented.' with an explicit TODO: 'we need to add a proper support for SingleStore'. Generated/computed columns are not yet wired up for SingleStore's datetime column type, so calling generatedAlwaysAs on it is intentionally a hard fail rather than producing invalid DDL.
Source
Thrown at drizzle-orm/src/singlestore-core/columns/datetime.ts:34
name: TName;
dataType: 'date';
columnType: 'SingleStoreDateTime';
data: Date;
driverParam: string | number;
enumValues: undefined;
generated: undefined;
}>;
export class SingleStoreDateTimeBuilder<T extends ColumnBuilderBaseConfig<'date', 'SingleStoreDateTime'>>
extends SingleStoreColumnBuilder<T, SingleStoreDatetimeConfig>
{
/** @internal */
// TODO: we need to add a proper support for SingleStore
override generatedAlwaysAs(
_as: SQL<unknown> | (() => SQL) | T['data'],
_config?: Partial<GeneratedColumnConfig<unknown>>,
): HasGenerated<this, {}> {
throw new Error('Method not implemented.');
}
static override readonly [entityKind]: string = 'SingleStoreDateTimeBuilder';
constructor(name: T['name']) {
super(name, 'date', 'SingleStoreDateTime');
}
/** @internal */
override build<TTableName extends string>(
table: AnySingleStoreTable<{ name: TTableName }>,
): SingleStoreDateTime<MakeColumnConfig<T, TTableName>> {
return new SingleStoreDateTime<MakeColumnConfig<T, TTableName>>(
table,
this.config as ColumnBuilderRuntimeConfig<any, any>,
);
}
}
View on GitHub (pinned to b7862528fd)
Solutions
- Avoid generatedAlwaysAs on SingleStore datetime columns; manage the value in application code (set on insert) or via a DEFAULT clause using .default(sql`CURRENT_TIMESTAMP`).
- Use a different column type for which generatedAlwaysAs is implemented, if the computed value is numeric/string.
- Track the SingleStore support TODO and update once implemented; until then do not rely on generated datetime columns.
Example fix
// before (throws - not implemented for SingleStore datetime)
export const t = singlestoreTable('t', {
createdAt: datetime('created_at').generatedAlwaysAs(sql`CURRENT_TIMESTAMP`),
});
// after (use default instead)
export const t = singlestoreTable('t', {
createdAt: datetime('created_at').default(sql`CURRENT_TIMESTAMP`),
}); Defensive patterns
Strategy: type-guard
Validate before calling
// Do not call generatedAlwaysAs on SingleStore datetime columns.
import { entityKind } from 'drizzle-orm/entity';
function isSingleStoreDateTimeBuilder(b: any): boolean {
return b?.[entityKind] === 'SingleStoreDateTimeBuilder';
}
// In schema code, branch away from generatedAlwaysAs when the builder is a
// SingleStore datetime builder; use .default(sql`...`) instead. Type guard
function isSingleStoreDateTimeColumnBuilder(b: unknown): boolean {
return (b as any)?.[Symbol.for('drizzle:entityKind')] === 'SingleStoreDateTimeBuilder';
} Try / catch
try {
const col = datetime('created_at').generatedAlwaysAs(sql`CURRENT_TIMESTAMP`);
} catch (e) {
if (e instanceof Error && e.message === 'Method not implemented.') {
const col = datetime('created_at').default(sql`CURRENT_TIMESTAMP`);
} else throw e;
} Prevention
- Avoid generatedAlwaysAs on SingleStore datetime columns; use .default(sql`...`).
- When porting schemas from MySQL/Postgres, audit generated datetime columns and convert to defaults.
- Track the upstream TODO until SingleStore generated-column support ships.
When it happens
Trigger: Defining a SingleStore datetime column with .generatedAlwaysAs(sql`...`) or .generatedAlwaysAs(() => sql`...`) in a schema: datetime('created_at').generatedAlwaysAs(sql`CURRENT_TIMESTAMP`).
Common situations: Porting a MySQL/Postgres Drizzle schema that uses generated datetime columns to SingleStore. Auto-generating schemas from existing SingleStore databases that have computed datetime columns.
Related errors
- Method not implemented.
- You have an empty array for "${name}" enum values
- Your "${f.path.join('->')}" field references a column "${tab
- No fields selected for table "${tableConfig.tsName}" ("${tab
- Set operator error (union / intersect / except): selected fi
AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03).
Data as JSON: /data/errors/d69a5fef43238597.json.
Report an issue: GitHub.