Suji
Suji
DTDrizzle Team
Created by Suji on 1/27/2024 in #help
Help with types relational query function
nice, thanks a lot now i have bunch of cleaning upto do 😁
28 replies
DTDrizzle Team
Created by Suji on 1/27/2024 in #help
Help with types relational query function
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbwFBzjAnmApnAQgV2ABsATARXyynQCUsBnfImAGhTUxwBFcKr0AwhAB2AM2ABzNqgzY4AUQAeMKAEMAxjAAqqgEZEGAdWAwAFnSKqYwEfWlwoWS9dtsAvnFFQIIOAHISKGAAL2CDAFpoED8AbiRQSFgOOQQ4AEFhdAAFCR19HA8vH39AkLCsSKgQAHowCXD1aCxY+PBoeFSJLG09AyExSRY4OryDIfxCEiGAN1UodVM5uELvXwCg0Iio2vrGxxaE9sQ4Us2Cz1WSjfLKmsh6GAlHenCAK3oWpCxFRPhG4QecCw4CIEHQWAYAGUFsDVHAALzDXK9LAACj8wLAoPBDD8Q2QqHEUAeADlVCAsAAuOCzeaLKDookPAD6wnJzXxcAMwgkZmpACYAKwANmWAEp7JZSezqbSFnN0VKYKz2XjjtzeaYBSLxfZYcRZXN5QyMSBVMQ1akNXy4ELRW4xQA6fDCYAAR0oqIl7FUsxgcwAkiRqRNgCR0b6rHNmWG-E6Xe7Pd6HXEvj8jv9AWBTBAYBB6NDTLCEUjRmi-NncxBmfQYWbLewwyHJujY8mxanvr84Jn4JjsRCLFYbACS45nCP6Kj2P2wRCC3XVPZUakRFghmbMuKEQA+OAr9ioSP+qDUteoyt5hdFs34w+oTzAJwkejUgDas5x19hjuPgZIAC69gPg4WCiFQWDCOoDDvpe+aFj+YZAfeDrAcMOZXtSm7oBeGHwYu3qoKhSAdkgSC9nAtY3nCiKpJ+g5OMOrhAiCc5QouQxwd+ZrLKm1TVEC9BEMAwgwOEJDAPQKLhMI3xicJslwAAArIDDqEEYBiQwCkwNUwgQOELpSeB4RzBI+AUqJ5G2PAJC6CWpzlCuHiqPQcCqJknJUcWKZkapcAITxiKqRAoiUYucT+VogU0QoyhqJoZb0MYZhDi4AIADwxTunbpkk-kBlBRD4CQWBpSOGVlmSFJAsokEvnAADWWDoKFcDRYue6IjwfDUP04gSBl7B+GufhwAAPv42F4uwugQBABgefYHXUctMVvlV7IAUgO5vn4ADuJimH4AG5d2BViFQdCMMwWicENqCbTVcn1W5zWtWFK2wvYKWmLVMCvXAhXqMVpXlSIlUotVWB7pNLqleIskkCW8NgSJWBTDtJYEMQ5CUNQ11MDAD3tTFa2LhtUNbfYBIPodNq-XERE7amogupoI5wF0PT5NDqL+vk1IZNkyL5GKiDsBRqRsjVHiItzZb9ZI-MoqR7CODA+BQMIcAyzgrnuZkcRuGRrnoFBnjs+lwyqBIIlWBjvXoCTACq-2A+9bVKCoGg8wYyVHeDmUhWF3lmjuy0okHbkvcIDXA6DZWMelGUuxHO3TjIKJC5kORljT9701qcAevwv32G41K06gRfUmW0dM8sbDi7TFECwY0MlgrVMUirYupuw-EqS8kj6Y4ks2ScUZC1AajO4V4FQITt33S7QwhyX+PoL9O5de5+3mrZuiOqX1Bvve7dYND7AAY6iMkAAsh5OHV3Ateb2XR0V2rqAa1rOskCjMbMi1kAS2SjCWVQB8TA2ztmyAGeN+AZVNFiNi3FVANiPH6OY1IVCUHsFxXBUBKBIDcDuVE9F2KrQljXI6Vd7x-lPGgYh657yEOYSQoi7gxRkUAf6N8AAGW+jCkB8NUII2+XEgA
28 replies
DTDrizzle Team
Created by Suji on 1/27/2024 in #help
Help with types relational query function
sure gimme a few mins
28 replies
DTDrizzle Team
Created by Suji on 1/27/2024 in #help
Help with types relational query function
table:BaseTable isn't used in the findMany query, 🤔 I'm using that to get the tableName Let me update code snippet
28 replies
DTDrizzle Team
Created by sik on 8/13/2023 in #help
What's the best way to deploy migrations on production database?
here is my migration script
import { config } from 'dotenv';
import { drizzle } from 'drizzle-orm/postgres-js';
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';
import { exit } from 'process';

config();

const migrateDb = async () => {
const connectionString = process.env.DATABASE_URL;

if (!connectionString) {
throw new Error('DATABASE_URL environment variable is not set');
}

const sql = postgres(connectionString, { max: 1 });
const db = drizzle(sql);

await migrate(db, { migrationsFolder: 'drizzle' });

console.info('Migrations are successfully applied');
exit(0);
};

void migrateDb();
import { config } from 'dotenv';
import { drizzle } from 'drizzle-orm/postgres-js';
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';
import { exit } from 'process';

config();

const migrateDb = async () => {
const connectionString = process.env.DATABASE_URL;

if (!connectionString) {
throw new Error('DATABASE_URL environment variable is not set');
}

const sql = postgres(connectionString, { max: 1 });
const db = drizzle(sql);

await migrate(db, { migrationsFolder: 'drizzle' });

console.info('Migrations are successfully applied');
exit(0);
};

void migrateDb();
This file lives at the root of the project and the migration folder 'drizzle' is also on the same level i use this on railway and on eb by just appending it to the build step as you have done, works so far for me
16 replies
DTDrizzle Team
Created by .deini on 7/4/2023 in #help
sql escaping on where
ran into a simillar issue where im conditionaly building the where clause where.push( sqlCONCAT(${users.firstName},' ', ${users.lastName}) ILIKE '%${name}%', ); this throws a bind message error you can build the string like this, where your adding the % within the interpolation sql`CONCAT(${users.firstName},' ', ${users.lastName}) ILIKE ${'%' + pageOptionsDto.name + '%'}
4 replies
DTDrizzle Team
Created by Suji on 6/1/2023 in #help
Infer return type for relational query with pagination
Nope
3 replies
DTDrizzle Team
Created by Suji on 5/29/2023 in #help
Doent infer type in Callback syntax for query
nvm, i expected relations to get inferred somehow from foreign keys, creations relations in drizzle worked
2 replies