Drizzle-kit not working as expected

If there is a file xyz.ts and it currently has one table and if I use npx drizzle-kit push it runs sucessfully I add one more table to same file and use the command again it throws error
[itsmishra@Rajat ayanami]$ npx drizzle-kit push
No config path provided, using default 'drizzle.config.ts'
Reading config file '/home/itsmishra/ayanami/drizzle.config.ts'
Using 'pg' driver for database querying
[⢿] Pulling schema from database...
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at /home/itsmishra/ayanami/node_modules/drizzle-kit/bin.cjs:20632:66
at Array.map (<anonymous>)
at defaultForColumn (/home/itsmishra/ayanami/node_modules/drizzle-kit/bin.cjs:20622:74)
at /home/itsmishra/ayanami/node_modules/drizzle-kit/bin.cjs:20219:36
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[itsmishra@Rajat ayanami]$
[itsmishra@Rajat ayanami]$ npx drizzle-kit push
No config path provided, using default 'drizzle.config.ts'
Reading config file '/home/itsmishra/ayanami/drizzle.config.ts'
Using 'pg' driver for database querying
[⢿] Pulling schema from database...
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at /home/itsmishra/ayanami/node_modules/drizzle-kit/bin.cjs:20632:66
at Array.map (<anonymous>)
at defaultForColumn (/home/itsmishra/ayanami/node_modules/drizzle-kit/bin.cjs:20622:74)
at /home/itsmishra/ayanami/node_modules/drizzle-kit/bin.cjs:20219:36
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[itsmishra@Rajat ayanami]$
import 'dotenv/config';
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
out: './drizzle',
schema: ['./src/schema/Guild.ts'],
dialect: 'postgresql',
dbCredentials: {
url: process.env.DATABASE_URL!,
},
strict: true,
verbose: true
});
import 'dotenv/config';
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
out: './drizzle',
schema: ['./src/schema/Guild.ts'],
dialect: 'postgresql',
dbCredentials: {
url: process.env.DATABASE_URL!,
},
strict: true,
verbose: true
});
1 Reply
Rajat Mishra
Rajat MishraOP2mo ago
import { pgTable, uuid, text, boolean, jsonb } from "drizzle-orm/pg-core";

// Define Permissions table
export const Guild = pgTable("guild", {
id: uuid("id").primaryKey().defaultRandom(),
guildId: text("guild_id"),
clientId: text("client_id"),
permissionsRoles: jsonb("permissions_roles").array().default([]),
permissionsUsers: jsonb("permissions_users").array().default([]),
permissionsStatus: boolean("permissions_status").default(false),
});

export const AntiLinkConfig = pgTable("anti_link_config", {
id: uuid("id").primaryKey().defaultRandom(),
guildId: text("guild_id"),
clientId: text("client_id"),
disallowedLinks: jsonb("disallowed_links").array().default([]),
excludedRoles: jsonb("excluded_roles").array().default([]),
excludedChannels: jsonb("excluded_channels").array().default([]),
antiLinkStatus: boolean("anti_link_status").default(false),
actionOnViolation: text("action_on_violation").default("DELETE_MESSAGE"),
actionDuration: jsonb("action_duration").default(null),
allowedLinks: jsonb("allowed_links").array().default([]),
});
import { pgTable, uuid, text, boolean, jsonb } from "drizzle-orm/pg-core";

// Define Permissions table
export const Guild = pgTable("guild", {
id: uuid("id").primaryKey().defaultRandom(),
guildId: text("guild_id"),
clientId: text("client_id"),
permissionsRoles: jsonb("permissions_roles").array().default([]),
permissionsUsers: jsonb("permissions_users").array().default([]),
permissionsStatus: boolean("permissions_status").default(false),
});

export const AntiLinkConfig = pgTable("anti_link_config", {
id: uuid("id").primaryKey().defaultRandom(),
guildId: text("guild_id"),
clientId: text("client_id"),
disallowedLinks: jsonb("disallowed_links").array().default([]),
excludedRoles: jsonb("excluded_roles").array().default([]),
excludedChannels: jsonb("excluded_channels").array().default([]),
antiLinkStatus: boolean("anti_link_status").default(false),
actionOnViolation: text("action_on_violation").default("DELETE_MESSAGE"),
actionDuration: jsonb("action_duration").default(null),
allowedLinks: jsonb("allowed_links").array().default([]),
});
Want results from more Discord servers?
Add your server