Leonardo Barbosa - Creatus
Leonardo Barbosa - Creatus
DTDrizzle Team
Created by Leonardo Barbosa - Creatus on 4/9/2024 in #help
Invalid drizzle query
schema drizzle studio:
import {
sqliteTable,
AnySQLiteColumn,
uniqueIndex,
text,
integer,
} from "drizzle-orm/sqlite-core";
import { sql } from "drizzle-orm";

export const users = sqliteTable(
"users",
{
id: text("id").primaryKey().notNull(),
name: text("name").notNull(),
registration: text("registration").notNull(),
createdAt: integer("created_at"),
level: integer("level").notNull(),
password: text("password").notNull(),
},
(table) => {
return {
registrationUnique: uniqueIndex("users_registration_unique").on(
table.registration,
),
};
},
);
import {
sqliteTable,
AnySQLiteColumn,
uniqueIndex,
text,
integer,
} from "drizzle-orm/sqlite-core";
import { sql } from "drizzle-orm";

export const users = sqliteTable(
"users",
{
id: text("id").primaryKey().notNull(),
name: text("name").notNull(),
registration: text("registration").notNull(),
createdAt: integer("created_at"),
level: integer("level").notNull(),
password: text("password").notNull(),
},
(table) => {
return {
registrationUnique: uniqueIndex("users_registration_unique").on(
table.registration,
),
};
},
);
12 replies
DTDrizzle Team
Created by Leonardo Barbosa - Creatus on 4/9/2024 in #help
Invalid drizzle query
Default values has deleted,
export const users = sqliteTable("users", {
id: text("id")
.$defaultFn(() => createId())
.primaryKey(),
name: text("name").notNull(),
registration: text("registration").notNull().unique(),
createdAt: integer("created_at", { mode: "timestamp" }),
level: integer("level").notNull(),
password: text("password").notNull(),
});
export const users = sqliteTable("users", {
id: text("id")
.$defaultFn(() => createId())
.primaryKey(),
name: text("name").notNull(),
registration: text("registration").notNull().unique(),
createdAt: integer("created_at", { mode: "timestamp" }),
level: integer("level").notNull(),
password: text("password").notNull(),
});
And the bunx drizzle-kit generate:sqlite and bunx drizzle-kit push:sqlite commands were performed
12 replies
DTDrizzle Team
Created by Leonardo Barbosa - Creatus on 4/9/2024 in #help
Invalid drizzle query
the schema in my application is
import { createId } from "@paralleldrive/cuid2";
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";

export const users = sqliteTable("users", {
id: text("id")
.$defaultFn(() => createId())
.primaryKey(),
name: text("name").notNull(),
registration: text("registration").notNull().unique(),
createdAt: integer("created_at", { mode: "timestamp" }),
level: integer("level").notNull(),
password: text("password").notNull(),
isDeleted: integer("is_deleted", { mode: "boolean" })
.notNull()
.default(false),
});
import { createId } from "@paralleldrive/cuid2";
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";

export const users = sqliteTable("users", {
id: text("id")
.$defaultFn(() => createId())
.primaryKey(),
name: text("name").notNull(),
registration: text("registration").notNull().unique(),
createdAt: integer("created_at", { mode: "timestamp" }),
level: integer("level").notNull(),
password: text("password").notNull(),
isDeleted: integer("is_deleted", { mode: "boolean" })
.notNull()
.default(false),
});
12 replies
DTDrizzle Team
Created by Leonardo Barbosa - Creatus on 4/9/2024 in #help
Invalid drizzle query
This is a schema from drizzle studio runner
12 replies