Open kylegwalsh opened 1 year ago
Does this also happen when you use a more recent version of Prisma?
Hi @janpio, it happened on prisma@4.11.0
.
It looks like it may only happen when converting the Text
fields to TinyText
or MediumText
?
If it helps, we are using PlanetScale for our DB.
It also seems to run fine on our dev
branch, but fails on another branch that has >2M records.
Interesting. The error is in our code, not on the database, so I am confused how this could be triggered by the amount of data in the database.
Can you share the before and after schema so we can understand the SQL this would generate to be executed?
@janpio I see one query logged in the Insights panel of PlanetScale from when I was experimenting with just changing the school district fields:
ALTER TABLE `Property` MODIFY `elementarySchoolDistrict` VARCHAR(191) NULL, MODIFY `middleOrJuniorSchoolDistrict` VARCHAR(191) NULL, MODIFY `highSchoolDistrict` VARCHAR(191) NULL
It looks like it impacted about 50% of the rows - so prisma did something that caused it to fail on the second half? Very strange!
The schema that I had before (and that I am currently using) is as follows.
model Property {
id String @id @default(cuid())
modificationTimestamp DateTime?
listingKey String
listingId String?
media Json? // Media[]
openHouse Json? // OpenHouse[]
propertyType PropertyType?
propertySubType PropertySubType?
listPrice Float?
unparsedAddress String?
unitNumber String?
postalCity String?
stateOrProvince State?
country Country?
postalCode String?
bathroomsFull Int?
bathroomsHalf Int?
bathroomsOneQuarter Int?
bathroomsThreeQuarter Int?
bathroomsTotalInteger Float?
bedroomsTotal Float?
standardStatus StandardStatus?
listPriceLow Float?
lotSizeAcres Float?
lotSizeUnits LotSizeUnits?
lotSizeArea Float?
livingArea Float?
livingAreaUnits AreaUnits?
latitude Float?
longitude Float?
listAgentFullName String?
listAgentEmail String?
listAgentKey String?
listAgentMlsId String?
listAgentPreferredPhone String?
listAgentOfficePhone String?
listAgentFirstName String?
listAgentLastName String?
listOfficeKey String?
listAgentStateLicense String?
listOfficeMlsId String?
listOfficeName String?
sourceSystemName String?
listOfficePhone String?
disclaimer String? @db.Text
publicRemarks String? @db.Text
photosCount Int?
photosChangeTimestamp DateTime?
sourceSystemID String?
yearBuilt Int?
yearBuiltEffective Int?
listingContractDate DateTime?
listAgentFax String?
listAgentURL String? @db.TinyText
elevation Float?
builderName String?
directions String? @db.Text
countyOrParish String?
parcelNumber String?
subdivisionName String?
elementarySchool String?
middleOrJuniorSchool String?
highSchool String?
elementarySchoolDistrict String? @db.Text
middleOrJuniorSchoolDistrict String? @db.Text
highSchoolDistrict String? @db.Text
appliances Json? // Appliances[]
cooling Json? // Cooling[]
constructionMaterials Json? // ConstructionMaterials[]
flooring Json? // Flooring[]
heating Json? // Heating[]
numberOfBuildings Int?
numberOfUnitsTotal Int?
fireplaceYN Boolean?
taxLegalDescription String? @db.Text
transactionType TransactionType?
propertyCondition Json? // PropertyCondition[]
storiesTotal Int?
parkingTotal Int?
parkingFeatures Json? // ParkingFeatures[]
roof Json? // Roof[]
view Json? // View[]
waterfrontYN Boolean?
franchiseAffiliation String?
interiorFeatures Json? // InteriorOrRoomFeatures[]
exteriorFeatures Json? // ExteriorFeatures[]
waterfrontFeatures Json? // WaterFrontFeatures[]
windowFeatures Json? // WindowFeatures[]
architecturalStyle Json? // ArchitecturalStyle[]
rooms Json? // Rooms[]
securityFeatures Json? // SecurityFeatures[]
otherStructures Json? // OtherStructures[]
structureType Json? // StructureType[]
utilities Json? // Utilities[]
patioAndPorchFeatures Json? // PatioAndPorchFeatures[]
accessibilityFeatures Json? // AccessibilityFeatures[]
specialListingConditions Json? // SpecialListingConditions[]
entryLevel String?
basement Json? // Basement[]
dock Boolean?
accessibleElevatorInstalled Boolean?
poolPrivateYN Boolean?
spaYN Boolean?
vegetation Json? // Vegetation[]
fencing Json? // Fencing[]
internetAddressDisplayYN Boolean?
internetAutomatedValuationDisplayYN Boolean?
internetConsumerCommentYN Boolean?
listPriceCurrencyType String?
listingURL String? @db.TinyText
leadRoutingEmail String?
brokerName String?
listingTitle String? @db.Text
customSourceId String?
listOfficeBrokerMlsId String?
listOfficeEmail String?
listOfficeAddress1 String?
listOfficeAddress2 String?
listOfficeCity String?
listOfficePostalCode String?
listOfficeStateOrProvince State?
listOfficeCountry Country?
builderPhone String?
builderFax String?
builderEmail String?
builderWebsiteURL String?
listBrokerageName String?
listBrokeragePhone String?
listBrokerageEmail String?
listBrokerageWebsiteUrl String?
listBrokerageLogoUrl String?
listBrokerageUnparsedAddress String?
listBrokerageUnitNumber String?
listBrokerageCity String?
listBrokerageStateOrProvince State?
listBrokeragePostalCode String?
listBrokerageCountry String?
roomCount Float?
geocodeOptions String?
alternatePrices Json? // { alternateListPrice?: number | null; alternateListPriceLow?: number | null; alternateListPriceCurrencyType?: string; }
expenses Json? // { expenseCategory?: ExpenseCategory; expenseValue?: number | null; expenseFrequency?: ExpenseFrequency; }
neighborhoods Json? // { name?: string | null; description?: string | null; }
taxes Json? // { taxYear?: string | null; taxAnnualAmount?: number | null; taxDescription?: string | null; }
mlsModificationTimestamp DateTime?
@@index([modificationTimestamp])
}
The only difference should really be that most fields are Text
rather than TinyText
or MediumText
.
Yeah none of that makes to much sense. Asking internally if we can pinpoint this. Can you maybe try again with a more recent version of Prisma?
I ran it on the latest stable version of Prisma (4.11.0). Are you referring to the dev builds?
Your original post showed Prisma CLI 4.7.0
, which would be what influences the migration.
@janpio Sorry for the confusion. I created this ticket and then tried a newer version (4.11.0) right afterwards. I ran into the issue on both.
Hi @kylegwalsh, I wonder if you managed to get a minimal reproduction of this issue by any chance (i.e., a repository we can build and run to observe the issue, and pick it up from there to understand and solve the problem)? Thanks.
Hey @jkomyno, I don't recall when I fixed this, but my schema file is showing all @db.TinyText and @db.MediumText now. I believe I reinitialized the database entirely to get the schema in sync? So I don't have anything to replicate the issue with anymore.
Hey @kylegwalsh, I see. Thanks for your reply anyway! We'll see what we can do.
Some more issues about the same: https://github.com/prisma/prisma/issues/12258 https://github.com/prisma/prisma/issues/18430 https://github.com/prisma/prisma/issues/15017 https://github.com/prisma/prisma/issues/14088 https://github.com/prisma/prisma/issues/10556 https://github.com/prisma/prisma/issues/8518
Hey,
We have tried seeding a MySQL database with 2.5M rows and run some migrations on the data. We couldn't reproduce anything so far :(
Hi Prisma Team! The following command just crashed.
Command
db push
Versions
Error
Schema.prisma