Skip to content

Raw tables require the Rust-based sync client. The JS client will ignore them. #672

@ivanvolti

Description

@ivanvolti

I'm seeing this warning in the console:
"Raw tables require the Rust-based sync client. The JS client will ignore them."

I'm not sure what's triggering it. Do I need to take any action here?

Just for more context, here's how I create db:

import { BackendConnector } from '@/db/powersync/connector';
import { wrapPowerSyncWithDrizzle } from '@powersync/drizzle-driver';
import { drizzleSchema } from '@/db/schema/client';
import {
  PowerSyncDatabase,
  WASQLiteOpenFactory,
  WASQLiteVFS,
  createBaseLogger,
  LogLevel,
} from '@powersync/web';
import { DrizzleAppSchema } from '@powersync/drizzle-driver';

const schema = new DrizzleAppSchema(drizzleSchema);

const logger = createBaseLogger();
logger.useDefaults();
logger.setLevel(LogLevel.DEBUG);

export const powerSyncDb = new PowerSyncDatabase({
  schema,
  database: new WASQLiteOpenFactory({
    dbFilename: 'powersync10.db',
    vfs: WASQLiteVFS.OPFSCoopSyncVFS,
    flags: {
      enableMultiTabs: typeof SharedWorker !== 'undefined',
      ssrMode: false,
    },
  }),
  flags: {
    enableMultiTabs: typeof SharedWorker !== 'undefined',
  },
});

const connector = new BackendConnector();
powerSyncDb.connect(connector);

export const drizzleDb = wrapPowerSyncWithDrizzle(powerSyncDb, {
  schema: drizzleSchema,
});

And in my connector I have this line:

clientImplementation: SyncClientImplementation = SyncClientImplementation.RUST;

Drizzle tables:

import { sqliteTable, text, integer, index, unique } from 'drizzle-orm/sqlite-core';
import { relations, sql } from 'drizzle-orm';

export const projects = sqliteTable('projects', {
  id: text('id')
    .primaryKey()
    .default(sql`uuid()`),
  userId: text('user_id').notNull(),
  name: text('name', { length: 100 }).notNull().default(''),
  status: text('status', { length: 20 }).notNull().default('new'),
  isDeleted: integer('is_deleted', { mode: 'boolean' }).notNull().default(false),
  createdAt: text('created_at')
    .notNull()
    .default(sql`datetime('now')`),
  updatedAt: text('updated_at')
    .notNull()
    .default(sql`datetime('now')`),
  completedAt: text('completed_at'),
});

export const todos = sqliteTable(
  'todos',
  {
    id: text('id')
      .primaryKey()
      .default(sql`uuid()`),
    userId: text('user_id').notNull(),
    projectId: text('project_id').references(() => projects.id, { onDelete: 'cascade' }),
    name: text('name', { length: 100 }).notNull().default(''),
    status: text('status', { length: 20 }).notNull().default('new'),
    when: text('when', { length: 20 }).notNull().default('week'),
    notes: text('notes'),
    isDeleted: integer('is_deleted', { mode: 'boolean' }).notNull().default(false),
    createdAt: text('created_at')
      .notNull()
      .default(sql`datetime('now')`),
    updatedAt: text('updated_at')
      .notNull()
      .default(sql`datetime('now')`),
    completedAt: text('completed_at'),
  },
  (table) => [index('todos_project_id_idx').on(table.projectId)],
);

export const settings = sqliteTable(
  'settings',
  {
    id: text('id')
      .primaryKey()
      .default(sql`uuid()`),
    userId: text('user_id').notNull(),
    clearCompletedAt: text('clear_completed_at'),
    createdAt: text('created_at')
      .notNull()
      .default(sql`datetime('now')`),
    updatedAt: text('updated_at')
      .notNull()
      .default(sql`datetime('now')`),
  },
  (table) => [unique('unique_settings').on(table.userId)],
);

export const projectsRelations = relations(projects, ({ many }) => ({
  todos: many(todos),
}));

export const todosRelations = relations(todos, ({ one }) => ({
  project: one(projects, {
    fields: [todos.projectId],
    references: [projects.id],
  }),
}));

export const drizzleSchema = {
  projects,
  todos,
  settings,
  projectsRelations,
  todosRelations,
};

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions