PAdventures
PAdventures
Explore posts from servers
DTDrizzle Team
Created by PAdventures on 12/19/2023 in #help
Dizzle Kit: Push altering unchanged column
CREATE TABLE `economy_profiles` (
`member_id` bigint unsigned NOT NULL,
`guild_id` bigint unsigned NOT NULL,
`wallet` int unsigned NOT NULL,
`bank` int unsigned NOT NULL,
`safe` int unsigned NOT NULL,
- `bank_level` tinyint unsigned NOT NULL DEFAULT '0',
- `safe_level` tinyint unsigned NOT NULL DEFAULT '0',
+ `bank_level` tinyint unsigned NOT NULL,
+ `safe_level` tinyint unsigned NOT NULL,
`created_at` date NOT NULL,
`updated_at` date NOT NULL,
PRIMARY KEY (`member_id`, `guild_id`),
UNIQUE KEY `economy_profiles_member_id_guild_id_unique` (`member_id`, `guild_id`),
UNIQUE KEY `member_id_guild_id_idx` (`member_id`, `guild_id`)
) ENGINE InnoDB,
CHARSET utf8mb4,
COLLATE utf8mb4_0900_ai_ci;
CREATE TABLE `economy_profiles` (
`member_id` bigint unsigned NOT NULL,
`guild_id` bigint unsigned NOT NULL,
`wallet` int unsigned NOT NULL,
`bank` int unsigned NOT NULL,
`safe` int unsigned NOT NULL,
- `bank_level` tinyint unsigned NOT NULL DEFAULT '0',
- `safe_level` tinyint unsigned NOT NULL DEFAULT '0',
+ `bank_level` tinyint unsigned NOT NULL,
+ `safe_level` tinyint unsigned NOT NULL,
`created_at` date NOT NULL,
`updated_at` date NOT NULL,
PRIMARY KEY (`member_id`, `guild_id`),
UNIQUE KEY `economy_profiles_member_id_guild_id_unique` (`member_id`, `guild_id`),
UNIQUE KEY `member_id_guild_id_idx` (`member_id`, `guild_id`)
) ENGINE InnoDB,
CHARSET utf8mb4,
COLLATE utf8mb4_0900_ai_ci;
I will push this to planetscale. I run the push again without doing anything and this happens:
CREATE TABLE `economy_profiles` (
`member_id` bigint unsigned NOT NULL,
`guild_id` bigint unsigned NOT NULL,
`wallet` int unsigned NOT NULL,
`bank` int unsigned NOT NULL,
`safe` int unsigned NOT NULL,
- `bank_level` tinyint unsigned NOT NULL,
- `safe_level` tinyint unsigned NOT NULL,
+ `bank_level` tinyint unsigned NOT NULL DEFAULT '0',
+ `safe_level` tinyint unsigned NOT NULL DEFAULT '0',
`created_at` date NOT NULL,
`updated_at` date NOT NULL,
PRIMARY KEY (`member_id`, `guild_id`),
UNIQUE KEY `economy_profiles_member_id_guild_id_unique` (`member_id`, `guild_id`),
UNIQUE KEY `member_id_guild_id_idx` (`member_id`, `guild_id`)
) ENGINE InnoDB,
CHARSET utf8mb4,
COLLATE utf8mb4_0900_ai_ci;
CREATE TABLE `economy_profiles` (
`member_id` bigint unsigned NOT NULL,
`guild_id` bigint unsigned NOT NULL,
`wallet` int unsigned NOT NULL,
`bank` int unsigned NOT NULL,
`safe` int unsigned NOT NULL,
- `bank_level` tinyint unsigned NOT NULL,
- `safe_level` tinyint unsigned NOT NULL,
+ `bank_level` tinyint unsigned NOT NULL DEFAULT '0',
+ `safe_level` tinyint unsigned NOT NULL DEFAULT '0',
`created_at` date NOT NULL,
`updated_at` date NOT NULL,
PRIMARY KEY (`member_id`, `guild_id`),
UNIQUE KEY `economy_profiles_member_id_guild_id_unique` (`member_id`, `guild_id`),
UNIQUE KEY `member_id_guild_id_idx` (`member_id`, `guild_id`)
) ENGINE InnoDB,
CHARSET utf8mb4,
COLLATE utf8mb4_0900_ai_ci;
15 replies
DTDrizzle Team
Created by PAdventures on 12/10/2023 in #help
ExecutedQuery data question
what do these attributes mean when it comes to planetscale? it's quite confusing
headers: string[];
types: Types;
rows: Row[];
fields: Field[];
size: number;
statement: string;
insertId: string;
rowsAffected: number;
time: number;
headers: string[];
types: Types;
rows: Row[];
fields: Field[];
size: number;
statement: string;
insertId: string;
rowsAffected: number;
time: number;
I assume time is how long the query took rowsAffected is that row read/row returned? rows I assume are the rows that were returned fields is assume are the table fields statment i assume is the raw SQL statement the others I have no clue
2 replies
DTDrizzle Team
Created by PAdventures on 11/28/2023 in #help
Migration Confirmation/Help with PlanetScale
I know I can test this myself but I want to reduce the connections to my PlanetScale database. So, I have my main branch which has a password to it, and a development branch off of the main branch with it's own password. If I use the dev url in the migration config file and main url for the drizzle connection will this cause any issues. Here is what I have done:
//drizzle.config.ts
import * as dotenv from 'dotenv';
import type { Config } from 'drizzle-kit';

dotenv.config();

export default {
schema: './db/schema/*',
driver: 'mysql2',
out: './drizzle',
dbCredentials: {
uri: process.env.DATABASE_DEV_URL ?? ''
}
} satisfies Config;
//drizzle.config.ts
import * as dotenv from 'dotenv';
import type { Config } from 'drizzle-kit';

dotenv.config();

export default {
schema: './db/schema/*',
driver: 'mysql2',
out: './drizzle',
dbCredentials: {
uri: process.env.DATABASE_DEV_URL ?? ''
}
} satisfies Config;
//drizzle connection
export class BaseUtility extends BaseModule {
// cool stuff up here

private planetScaleClient: Client = new Client({ url: process.env.DATABASE_MAIN_URL, fetch: undiciFetch });
private planetScaleAdapter: PrismaPlanetScale = new PrismaPlanetScale(this.planetScaleClient);
public prisma: PrismaClient = new PrismaClient({ adapter: this.planetScaleAdapter });
// more cool stuff down here
}
//drizzle connection
export class BaseUtility extends BaseModule {
// cool stuff up here

private planetScaleClient: Client = new Client({ url: process.env.DATABASE_MAIN_URL, fetch: undiciFetch });
private planetScaleAdapter: PrismaPlanetScale = new PrismaPlanetScale(this.planetScaleClient);
public prisma: PrismaClient = new PrismaClient({ adapter: this.planetScaleAdapter });
// more cool stuff down here
}
1 replies