deadlinecode
deadlinecode
Explore posts from servers
DTDrizzle Team
Created by deadlinecode on 1/16/2024 in #help
Single Selects don't work with JSON fields
5 replies
DTDrizzle Team
Created by terryball on 1/16/2024 in #help
Safe to delete migration files?
Hope that helps For the snapshot.json files you will have to wait for somebody else to answer 😅
6 replies
DTDrizzle Team
Created by terryball on 1/16/2024 in #help
Safe to delete migration files?
If you are developing and you run drizzle-kit generate a couple of times you can delete the sql files that are new to the drizzle folder and generate on last time bevore putting the app on prod so that drizzle generates only one sql file that migrates the data
6 replies
DTDrizzle Team
Created by terryball on 1/16/2024 in #help
Safe to delete migration files?
If you are developing and you don't have the migration files on prod or somewhere where they are actually needed you can just delete them Drizzle will create new ones on the next drizzle-kit generate But if you actually have migration files that are on prod and users are using them / you are using them via the migrate function you should keep them because they tell drizzle how to migrate the already existing data to the new schema
6 replies
DTDrizzle Team
Created by deadlinecode on 1/16/2024 in #help
Single Selects don't work with JSON fields
I basically saw that the code tried to index the values so i just converted the single objects to its values so it could get indexed properly
5 replies
DTDrizzle Team
Created by deadlinecode on 1/16/2024 in #help
Single Selects don't work with JSON fields
I was able to temporary fix it by doing following: utils.js
const rawValue = row[columnIndex] || Object.values(row)[columnIndex];
const value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue);
const rawValue = row[columnIndex] || Object.values(row)[columnIndex];
const value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue);
relations.js
const value = mapColumnValue(row[selectionItemIndex] || Object.values(row)[selectionItemIndex]);
const field = selectionItem.field;
let decoder;
if (is(field, Column)) {
decoder = field;
} else if (is(field, SQL)) {
decoder = field.decoder;
} else {
decoder = field.sql.decoder;
}
result[selectionItem.tsKey] = value === null ? null : decoder.mapFromDriverValue(value);
const value = mapColumnValue(row[selectionItemIndex] || Object.values(row)[selectionItemIndex]);
const field = selectionItem.field;
let decoder;
if (is(field, Column)) {
decoder = field;
} else if (is(field, SQL)) {
decoder = field.decoder;
} else {
decoder = field.sql.decoder;
}
result[selectionItem.tsKey] = value === null ? null : decoder.mapFromDriverValue(value);
5 replies