Massimo
Massimo
DTDrizzle Team
Created by louis on 10/2/2023 in #help
No such table: main.__old_push_[TABLENAME]
@Mykhailo unfortunately the issue seems to persist even with this change (same behaviour as before)
77 replies
DTDrizzle Team
Created by louis on 10/2/2023 in #help
No such table: main.__old_push_[TABLENAME]
To ""solve"" the problem, currently I have to comment my schema, push, reverse the change and push again (not a viable solution for production, but seems the only to workaround that works for the time being)
77 replies
DTDrizzle Team
Created by louis on 10/2/2023 in #help
No such table: main.__old_push_[TABLENAME]
Hi @Mykhailo, having the same issue (seems unrelated to my Clerk auth), here's my schema.ts if it can help.
import { createId } from "@paralleldrive/cuid2";
import { relations, sql } from "drizzle-orm";
import { sqliteTableCreator, text } from "drizzle-orm/sqlite-core";

export const createTable = sqliteTableCreator((name) => `myproject_${name}`);

export const users = createTable("users", {
id: text("id", { length: 128 }).primaryKey(),
name: text("name"),
});

export const usersRelations = relations(users, ({ many }) => ({
lists: many(lists),
}));

export const lists = createTable("lists", {
id: text("id", { length: 128 })
.$defaultFn(() => createId())
.primaryKey(),
userId: text("userId", { length: 128 }).notNull(),
name: text("name", { length: 64 }).notNull(),
description: text("description", { length: 256 }),
createdAt: text("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
readOnlyId: text("readOnlyId", { length: 128 }).$defaultFn(() => createId()),
});

export const listsRelations = relations(lists, ({ one }) => ({
author: one(users, {
fields: [lists.userId],
references: [users.id],
}),
}));

export const items = createTable("items", {
id: text("id", { length: 128 })
.$defaultFn(() => createId())
.primaryKey(),
listId: text("listId", { length: 128 })
.references(() => lists.id, { onDelete: "cascade" })
.notNull(),
sourceLink: text("sourceLink", { length: 256 }),
tagLink: text("tagLink", { length: 256 }),
name: text("name", { length: 64 }).notNull(),
description: text("description", { length: 256 }),
createdAt: text("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
});

export const itemsRelations = relations(items, ({ one }) => ({
author: one(lists, {
fields: [items.listId],
references: [lists.id],
}),
}));
import { createId } from "@paralleldrive/cuid2";
import { relations, sql } from "drizzle-orm";
import { sqliteTableCreator, text } from "drizzle-orm/sqlite-core";

export const createTable = sqliteTableCreator((name) => `myproject_${name}`);

export const users = createTable("users", {
id: text("id", { length: 128 }).primaryKey(),
name: text("name"),
});

export const usersRelations = relations(users, ({ many }) => ({
lists: many(lists),
}));

export const lists = createTable("lists", {
id: text("id", { length: 128 })
.$defaultFn(() => createId())
.primaryKey(),
userId: text("userId", { length: 128 }).notNull(),
name: text("name", { length: 64 }).notNull(),
description: text("description", { length: 256 }),
createdAt: text("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
readOnlyId: text("readOnlyId", { length: 128 }).$defaultFn(() => createId()),
});

export const listsRelations = relations(lists, ({ one }) => ({
author: one(users, {
fields: [lists.userId],
references: [users.id],
}),
}));

export const items = createTable("items", {
id: text("id", { length: 128 })
.$defaultFn(() => createId())
.primaryKey(),
listId: text("listId", { length: 128 })
.references(() => lists.id, { onDelete: "cascade" })
.notNull(),
sourceLink: text("sourceLink", { length: 256 }),
tagLink: text("tagLink", { length: 256 }),
name: text("name", { length: 64 }).notNull(),
description: text("description", { length: 256 }),
createdAt: text("created_at")
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
});

export const itemsRelations = relations(items, ({ one }) => ({
author: one(lists, {
fields: [items.listId],
references: [lists.id],
}),
}));
77 replies