DT
Drizzle Team•8mo ago
Derock

cannot migrate database: PostgresError: unterminated /* comment at or near "/*

logs:
Tasks: 10 successful, 10 total
Cached: 2 cached, 10 total
Time: 6.717s

📦 Running database migrations...
{
severity_local: 'NOTICE',
severity: 'NOTICE',
code: '42P06',
message: 'schema "drizzle" already exists, skipping',
file: 'schemacmds.c',
line: '132',
routine: 'CreateSchemaCommand'
}
{
severity_local: 'NOTICE',
severity: 'NOTICE',
code: '42P07',
message: 'relation "__drizzle_migrations" already exists, skipping',
file: 'parse_utilcmd.c',
line: '207',
routine: 'transformCreateStmt'
}
node:internal/process/esm_loader:34
internalBinding('errors').triggerUncaughtException(
^

PostgresError: unterminated /* comment at or near "/*
DO $$ BEGIN
CREATE TYPE "LeagueRank" AS ENUM('CHALLENGER', 'GRANDMASTER', 'MASTER', 'DIAMOND', 'PLATINUM', 'GOLD', 'SILVER', 'BRONZE', 'IRON');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
"
at ErrorResponse (file:///home/derock/Documents/Code/poroscout/node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js:790:26)
at handle (file:///home/derock/Documents/Code/poroscout/node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js:476:6)
at TLSSocket.data (file:///home/derock/Documents/Code/poroscout/node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js:315:9)
at TLSSocket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '42601',
position: '160',
file: 'scan.l',
line: '1241',
routine: 'scanner_yyerror'
}

Node.js v20.11.1
/home/derock/Documents/Code/poroscout/apps/bot:
 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command failed with exit code 1: database
Tasks: 10 successful, 10 total
Cached: 2 cached, 10 total
Time: 6.717s

📦 Running database migrations...
{
severity_local: 'NOTICE',
severity: 'NOTICE',
code: '42P06',
message: 'schema "drizzle" already exists, skipping',
file: 'schemacmds.c',
line: '132',
routine: 'CreateSchemaCommand'
}
{
severity_local: 'NOTICE',
severity: 'NOTICE',
code: '42P07',
message: 'relation "__drizzle_migrations" already exists, skipping',
file: 'parse_utilcmd.c',
line: '207',
routine: 'transformCreateStmt'
}
node:internal/process/esm_loader:34
internalBinding('errors').triggerUncaughtException(
^

PostgresError: unterminated /* comment at or near "/*
DO $$ BEGIN
CREATE TYPE "LeagueRank" AS ENUM('CHALLENGER', 'GRANDMASTER', 'MASTER', 'DIAMOND', 'PLATINUM', 'GOLD', 'SILVER', 'BRONZE', 'IRON');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
"
at ErrorResponse (file:///home/derock/Documents/Code/poroscout/node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js:790:26)
at handle (file:///home/derock/Documents/Code/poroscout/node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js:476:6)
at TLSSocket.data (file:///home/derock/Documents/Code/poroscout/node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js:315:9)
at TLSSocket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '42601',
position: '160',
file: 'scan.l',
line: '1241',
routine: 'scanner_yyerror'
}

Node.js v20.11.1
/home/derock/Documents/Code/poroscout/apps/bot:
 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command failed with exit code 1: database
Relavent code:
/**
* Runs migrations on the database.
* @param connectionString
*/
export async function runMigrations(connectionString?: string) {
await migrate(createDatabaseClient(connectionString, { max: 1 }), {
migrationsFolder: path.join(__dirname, "../drizzle"),
});
}
/**
* Runs migrations on the database.
* @param connectionString
*/
export async function runMigrations(connectionString?: string) {
await migrate(createDatabaseClient(connectionString, { max: 1 }), {
migrationsFolder: path.join(__dirname, "../drizzle"),
});
}
Migration File:
DO $$ BEGIN
CREATE TYPE "LeaguePlatform" AS ENUM('BR1', 'EUN1', 'EUW1', 'JP1', 'KR', 'LA1', 'LA2', 'NA1', 'OC1', 'TR1', 'RU', 'PH2', 'SG2', 'TH2', 'TW2', 'VN2');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
ALTER TYPE "LeagueRank" ADD VALUE 'EMERALD';--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "channel_webhook_credentials" (
"channelId" text PRIMARY KEY NOT NULL,
"webhookId" text NOT NULL,
"webhookToken" text NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "leaguesgg_tornament_subscription" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"guildId" text NOT NULL,
"channelId" text NOT NULL,
"platform" "LeaguePlatform" NOT NULL,
"role" text NOT NULL
);
--> statement-breakpoint
ALTER TABLE "User" ALTER COLUMN "premiumExpires" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "User" ALTER COLUMN "linkedAt" SET DEFAULT now();--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "channel_webhook_credentials_channelId_key" ON "channel_webhook_credentials" ("channelId");--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "leaguesgg_tornament_subscription_channel_region_idx" ON "leaguesgg_tornament_subscription" ("channelId","platform");--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "leaguesgg_tornament_subscription" ADD CONSTRAINT "leaguesgg_tornament_subscription_channelId_channel_webhook_credentials_channelId_fk" FOREIGN KEY ("channelId") REFERENCES "channel_webhook_credentials"("channelId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
DO $$ BEGIN
CREATE TYPE "LeaguePlatform" AS ENUM('BR1', 'EUN1', 'EUW1', 'JP1', 'KR', 'LA1', 'LA2', 'NA1', 'OC1', 'TR1', 'RU', 'PH2', 'SG2', 'TH2', 'TW2', 'VN2');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
ALTER TYPE "LeagueRank" ADD VALUE 'EMERALD';--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "channel_webhook_credentials" (
"channelId" text PRIMARY KEY NOT NULL,
"webhookId" text NOT NULL,
"webhookToken" text NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "leaguesgg_tornament_subscription" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"guildId" text NOT NULL,
"channelId" text NOT NULL,
"platform" "LeaguePlatform" NOT NULL,
"role" text NOT NULL
);
--> statement-breakpoint
ALTER TABLE "User" ALTER COLUMN "premiumExpires" SET DEFAULT now();--> statement-breakpoint
ALTER TABLE "User" ALTER COLUMN "linkedAt" SET DEFAULT now();--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "channel_webhook_credentials_channelId_key" ON "channel_webhook_credentials" ("channelId");--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "leaguesgg_tornament_subscription_channel_region_idx" ON "leaguesgg_tornament_subscription" ("channelId","platform");--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "leaguesgg_tornament_subscription" ADD CONSTRAINT "leaguesgg_tornament_subscription_channelId_channel_webhook_credentials_channelId_fk" FOREIGN KEY ("channelId") REFERENCES "channel_webhook_credentials"("channelId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server