prisma / prisma

Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB
https://www.prisma.io
Apache License 2.0
38.33k stars 1.49k forks source link

Issues running prisma migration via `db push`: `index out of bounds: the len is 1 but the index is 10` #18237

Open kylegwalsh opened 1 year ago

kylegwalsh commented 1 year ago

Hi Prisma Team! The following command just crashed.

Command

db push

Versions

Name Version
Platform windows
Node v16.17.0
Prisma CLI 4.7.0
Engine 39190b250ebc338586e25e6da45e5e783bc8a635

Error

Error: Error in migration engine.
Reason: [C:\Users\runneradmin\.cargo\git\checkouts\quaint-9f01e008b9a89c14\08831df\src\connector\result_set\result_row.rs:59:64] index out of bounds: the len is 1 but the index is 10

Please create an issue with your `schema.prisma` at
https://github.com/prisma/prisma/issues/new

Schema.prisma

// ---------------------- START SETUP ---------------------- //

// Define our actual prisma client
generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "rhel-openssl-1.0.x"]
}

// Define where zod output types will be generated
generator zod {
  provider = "prisma-zod-generator"
  output   = "../node_modules/@prisma/client/generated"
}

// Define how models are handled
generator zodModels {
  provider              = "zod-prisma"
  output                = "../node_modules/@prisma/client/generated/models" // (default) the directory where generated zod schemas will be saved
  relationModel         = true // (default) Create and export both plain and related models.
  modelCase             = "PascalCase" // (default) Output models using pascal case (ex. UserModel, PostModel)
  modelSuffix           = "Model" // (default) Suffix to apply to your prisma models when naming Zod schemas
  useDecimalJs          = true // represent the prisma Decimal type using Decimal.js (as Prisma does)
  imports               = null // (default) will import the referenced file in generated schemas to be used via imports.someExportedVariable
  // https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-by-null-values
  prismaJsonNullability = true // (default) uses prisma's scheme for JSON field nullability
}

// Define our database connection
datasource db {
  provider     = "mysql"
  url          = env("DATABASE_URL")
  relationMode = "prisma"
}

// ---------------------- END SETUP ---------------------- //

// ---------------------- START PROPERTY ---------------------- //

// A property listing and all of the relevant information for our search feature
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.TinyText
  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.TinyText
  middleOrJuniorSchoolDistrict        String?          @db.TinyText
  highSchoolDistrict                  String?          @db.TinyText
  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])
}

// A modal for storing a search filter created by a user
// model SavedSearch {
//   id       String  @id @default(cuid())
//   bedsMin  Int?
//   bedsMax  Int?
//   bathsMin Int?
//   bathsMax Int?
//   priceMin Int?
//   priceMax Int?
//   sqftMin  Int?
//   sqftMax  Int?
//   latMin   Float?
//   latMax   Float?
//   lngMin   Float?
//   lngMax   Float?
//   User     User?   @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
//   userId   String?
//   isActive Boolean @default(false)
// }

enum PropertyType {
  BusinessOpportunity
  CommercialLease
  CommercialSale
  Farm
  Land
  ManufacturedInPark
  Residential
  ResidentialIncome
  ResidentialLease
  ResidentialCommonInterest
  ResidentialMultiFamily
  Other
}

enum PropertySubType {
  Apartment
  BoatSlip
  Cabin
  Condominium
  DeededParking
  Duplex
  Farm
  ManufacturedHome
  ManufacturedOnLand
  MobileHome
  OwnYourOwn
  Quadruplex
  Ranch
  SingleFamilyAttached
  SingleFamilyResidence
  StockCooperative
  Timeshare
  Townhouse
  Triplex
  Agriculture
  Business
  HotelMotel
  Industrial
  MixedUse
  MultiFamily
  Office
  Other
  Retail
  UnimprovedLand
  Warehouse
}

enum PropertyCondition {
  Fixer
  NewConstruction
  UnderConstruction
  UpdatedRemodeled
}

enum StandardStatus {
  Active
  ActiveUnderContract
  Canceled
  Closed
  ComingSoon
  Delete
  Expired
  Hold
  Incomplete
  Pending
  Withdrawn
}

enum Roof {
  Aluminum
  AsbestosShingle
  Asphalt
  Bahama
  Barrel
  Bituthene
  BuiltUp
  Composition
  Concrete
  Copper
  Elastomeric
  Fiberglass
  Flat
  FlatTile
  Foam
  GreenRoof
  Mansard
  Membrane
  Metal
  Mixed
  None
  Other
  RolledHotMop
  Rubber
  SeeRemarks
  Shake
  Shingle
  Slate
  SpanishTile
  Stone
  Synthetic
  TarGravel
  Tile
  Wood
}

enum SecurityFeatures {
  Security
  SecurityAlarm
  SecurityLighting
  SecuritySystem
}

enum SpecialListingConditions {
  Auction
  BankruptcyProperty
  HudOwned
  InForeclosure
  NoticeOf
  ProbateListing
  RealEstateOwned
  ShortSale
  Standard
  ThirdPartyApproval
}

enum StructureType {
  Cabin
  Dock
  Duplex
  Flex
  HotelMotel
  House
  Industrial
  ManufacturedHouse
  MixedUse
  MultiFamily
  None
  Office
  Quadruplex
  Retail
  Townhouse
  Triplex
  Warehouse
}

enum TransactionType {
  ForSale
  ForRent
}

enum Utilities {
  CableAvailable
  CableConnected
  CableNotAvailable
  ElectricityAvailable
  ElectricityConnected
  ElectricityNotAvailable
  NaturalGasAvailable
  NaturalGasConnected
  NaturalGasNotAvailable
  None
  Other
  PhoneAvailable
  PhoneConnected
  PhoneNotAvailable
  Propane
  SeeRemarks
  SewerAvailable
  SewerConnected
  SewerNotAvailable
  UndergroundUtilities
  WaterAvailable
  WaterConnected
  WaterNotAvailable
}

enum Vegetation {
  Brush
  Cleared
  Crops
  Grassed
  HeavilyWooded
  NaturalState
  Other
  PartiallyWooded
  SeeRemarks
  Wooded
}

enum View {
  Airport
  Average
  Bluff
  Bridge
  Canyon
  City
  Desert
  Forest
  GolfCourse
  Harbor
  Hills
  Lake
  Marina
  Mountains
  None
  Ocean
  Other
  Panorama
  Park
  Ravine
  River
  Territorial
  Unknown
  Valley
  Vista
  Water
}

enum WaterfrontFeatures {
  BeachAccess
  BeachFront
  CanalAccess
  Creek
  Lagoon
  Lake
  LakeFront
  LakePrivileges
  NavigableWater
  OceanAccess
  OceanFront
  Pond
  RiverAccess
  RiverFront
  Seawall
  Stream
  Waterfront
}

enum WindowFeatures {
  AluminumFrames
  BayWindows
  Blinds
  Display
  DoublePaneWindows
  Drapes
  EnergyStarQualifiedWindows
  GardenWindows
  InsulatedWindows
  LowEmissivityWindows
  PlantationShutters
  Screens
  Shutters
  Skylights
  SolarScreens
  StormWindows
  TintedWindows
  TriplePaneWindows
  WindowCoverings
  WindowTreatments
  WoodFrames
}

enum LotSizeUnits {
  Acres
  SquareFeet
  SquareMeters
  SquareYard
  Hectare
}

enum AreaUnits {
  SquareFeet
  SquareMeters
}

enum Appliances {
  BarbequeOrGrill
  CoffeeSystem
  CoffeeSystemRoughIn
  Cooktop
  CooktopElectric
  CooktopElectric2Burner
  CooktopElectric6Burner
  CooktopGas
  CooktopGas2Burner
  CooktopGas5Burner
  CooktopGas6Burner
  CooktopGasCustom
  CooktopInduction
  CooktopInduction2Burner
  CooktopInduction6Burner
  Dishwasher
  DishwasherDrawer
  DishwasherTwoOrMore
  Dryer
  DryerDualFuel
  DryerElectric110V
  DryerElectric220V
  DryerGas
  DryerGasRoughIn
  Freezer
  FreezerCompact
  FreezerUpright
  GarbageDisposer
  IceMaker
  Microwave
  None
  Other
  Oven
  OvenConvection
  OvenDouble
  OvenDoubleElectric
  OvenDoubleGas
  OvenGas
  OvenGas3Wide
  OvenSelfCleaning
  OvenSteam
  OvenTwin
  OvenTwinElectric
  OvenTwinGas
  OvenTwinGas3Wide
  OvenTwinMixed
  Range
  RangeBuiltIn
  RangeDual
  RangeDual10Burner
  RangeDual6Burner
  RangeDual8Burner
  RangeElectric
  RangeGas
  RangeGas10Burner
  RangeGas6Burner
  RangeGas8Burner
  RangeInduction
  RangeOther
  RangetopElectric
  RangetopElectric2Burner
  RangetopElectric6Burner
  RangetopGas
  RangetopGas10Burner
  RangetopGas2Burner
  RangetopGas4BurnerCompact
  RangetopGas6Burner
  RangetopGas8Burner
  RangetopGasCustom
  RangetopInduction
  RangetopInduction2Burner
  RangetopInduction6Burner
  Refrigerator
  RefrigeratorBar
  RefrigeratorBuiltIn
  RefrigeratorBuiltInWithPlumbing
  RefrigeratorDrawer
  RefrigeratorSideBySide
  RefrigeratorUndercounter
  RefrigeratorWineStorage
  RefrigeratorWithPlumbing
  TrashCompactor
  VacuumSystem
  VacuumSystemRoughIn
  VentHood
  VentHood10Burner
  VentHood6Burner
  VentHood8Burner
  WarmingDrawer
  Washer
  WasherFrontLoad
  WasherSteamer
  WasherTopLoad
  WasherDryerCombo
  WasherDryerStacked
  WaterFilter
  WaterInstantHot
  WaterPurifier
  WaterSoftener
}

enum Heating {
  Baseboard
  CentralFurnace
  ElectricAirFilter
  Fireplaces
  FireplaceInsert
  FloorFurnace
  FloorWall
  ForcedAir
  Geothermal
  GravityAir
  GravityHotWater
  HeatPump
  HotWater
  HotWaterRadiantFloor
  Humidifier
  None
  Other
  PelletStove
  Radiant
  RadiantCeiling
  RadiantFloor
  Radiator
  SWChangeover
  SolarActive
  SolarActiveAndPassive
  SolarPassive
  SpaceHeater
  Steam
  Stove
  Unknown
  WallUnit
  Zoned
}

enum Cooling {
  AtticFan
  CeilingFans
  CentralAC
  CentralEvaporative
  CentralFan
  ChilledWater
  Dehumidifiers
  DessicantCooler
  Evaporative
  HeatPump
  None
  Other
  Partial
  RadiantFloor
  RadiantFloorGroundLoop
  RefrigeratorEvaporative
  SolarACActive
  SolarACPassive
  Unknown
  WallUnitsAC
  WallUnitsEvaporative
  WindowUnitsAC
  WindowUnitsEvaporative
  ZonedAC
}

enum ConstructionMaterials {
  Adobe
  AluminumSiding
  Asbestos
  Asphalt
  AtticCrawlHatchwaysInsulated
  BattsInsulation
  Block
  BlownInInsulation
  BoardAndBattenSiding
  Brick
  BrickVeneer
  Cedar
  CementSiding
  Clapboard
  Concrete
  DuctsProfessionallyAirSealed
  ExteriorDuctWorkIsInsulated
  FiberCement
  FiberglassSiding
  FoamInsulation
  Frame
  Glass
  HardiplankType
  IcatRecessedLighting
  InsulatedConcreteForms
  LapSiding
  Log
  LogSiding
  LowVocInsulation
  Masonite
  MetalSiding
  NaturalBuilding
  Other
  Plaster
  RadiantBarrier
  RammedEarth
  RecycledBioBasedInsulation
  RedwoodSiding
  SeeRemarks
  ShakeSiding
  ShingleSiding
  SlumpBlock
  SprayFoamInsulation
  SteelSiding
  Stone
  StoneVeneer
  Straw
  Stucco
  SyntheticStucco
  Unknown
  VerticalSiding
  VinylSiding
  WoodSiding
}

enum Flooring {
  Bamboo
  Brick
  Carpet
  CarpetFull
  CarpetPartial
  Concrete
  ConcreteBare
  ConcretePainted
  Cork
  Drainage
  EngineeredWood
  Glass
  Granite
  Hardwood
  Laminate
  Linoleum
  LoadRestriction
  Marble
  None
  Other
  ParquetWood
  RoughIn
  Slate
  Softwood
  SolidWood
  Specialty
  SpecialtyConcrete
  Tile
  TileCeramic
  TilePorcelain
  TileStone
  TileOrStone
  Unknown
  Vinyl
  Wood
}

enum ParkingFeatures {
  Alley
  Assigned
  Boat
  BuiltIn
  Carport
  Commercial
  Covered
  Driveway
  Fee
  Fenced
  Garage
  GarageAttached
  GarageDetached
  Gated
  GolfCart
  Guest
  Heated
  Leased
  Mechanics
  Meter
  Mixed
  None
  OffAlley
  OffStreet
  OffSite
  OnStreet
  Open
  Other
  Oversized
  Owned
  ParkingLot
  ParkingStructure
  PavedOrSurfaced
  Pole
  PorteCochere
  PullThrough
  Ramp
  RV
  Secured
  SideApron
  SideBySide
  SpecialNeeds
  Stacked
  Tandem
  TuckUnder
  Unassigned
  UndergroundBasement
  Unimproved
  Unknown
  Valet
  Workshop
  ZonedPermit
}

enum InteriorOrRoomFeatures {
  Bar
  BeamedCeilings
  Bidet
  Bookcases
  BreakfastBar
  BuiltInFeatures
  CathedralCeilings
  CedarClosets
  CeilingFans
  CentralVacuum
  Chandelier
  CofferedCeilings
  CrownMolding
  DoubleVanity
  DryBar
  Dumbwaiter
  EatInKitchen
  Elevator
  EntranceFoyer
  GraniteCounters
  HighCeilings
  HighSpeedInternet
  HisAndHersClosets
  InLawFloorplan
  KitchenIsland
  LaminateCounters
  LowFlowPlumbingFixtures
  MasterDownstairs
  NaturalWoodwork
  OpenFloorplan
  Other
  Pantry
  RecessedLighting
  Sauna
  SeeRemarks
  SmartHome
  SmartThermostat
  SoakingTub
  SolarTubes
  SoundSystem
  StoneCounters
  Storage
  TileCounters
  TrackLighting
  TrayCeilings
  VaultedCeilings
  WalkInClosets
  WaterSenseFixtures
  WetBar
  WiredForData
  WiredForSound
}

enum ExteriorFeatures {
  Awning
  Balcony
  Barbecue
  BasketballCourt
  BoatSlip
  BuiltInBarbecue
  Courtyard
  Dock
  DogRun
  ElectricGrill
  FirePit
  Garden
  GasGrill
  GrayWaterSystem
  Kennel
  Lighting
  MistingSystem
  None
  Other
  OutdoorGrill
  OutdoorKitchen
  OutdoorShower
  PermeablePaving
  Playground
  PrivateEntrance
  PrivateYard
  RainBarrel
  RainGutters
  RvHookup
  Storage
  TennisCourts
  UncoveredCourtyard
}

enum ArchitecturalStyle {
  AFrame
  ArtDeco
  Bungalow
  CapeCod
  Colonial
  Contemporary
  Conventional
  Cottage
  Craftsman
  Creole
  Dome
  DutchColonial
  English
  Federal
  French
  FrenchProvincial
  Georgian
  GothicRevival
  GreekRevival
  HighRise
  Historical
  International
  Italianate
  Loft
  Mansion
  Mediterranean
  Modern
  Monterey
  Mountain
  National
  Neoclassical
  NewTraditional
  Other
  Prairie
  Pueblo
  QueenAnne
  Rambler
  Ranch
  Regency
  Rustic
  Saltbox
  SantaFe
  SecondEmpire
  Shed
  Shingle
  Shotgun
  Spanish
  SpanishEclectic
  SplitLevel
  Stick
  Tudor
  Victorian
}

enum OtherStructures {
  AirplaneHangar
  Arena
  Barns
  BoatHouse
  Cabana
  Caves
  Corrals
  CoveredArena
  Garages
  Gazebo
  GrainStorage
  Greenhouse
  GuestHouse
  KennelDogRun
  MobileHome
  None
  Other
  Outbuilding
  OutdoorKitchen
  PackingShed
  Pergola
  PoolHouse
  PoultryCoop
  Residence
  RvBoatStorage
  SecondGarage
  SecondResidence
  SeeRemarks
  Sheds
  Stables
  Storage
  TennisCourts
  Workshop
}

enum PatioAndPorchFeatures {
  Patio
  Porch
  Deck
}

enum AccessibilityFeatures {
  AccessibleApproachWithRamp
  AccessibleBedroom
  AccessibleCentralLivingArea
  AccessibleClosets
  AccessibleCommonArea
  AccessibleDoors
  AccessibleElectricalAndEnvironmentalControls
  AccessibleElevatorInstalled
  AccessibleEntrance
  AccessibleForHearingImpairment
  AccessibleFull
  AccessibleHallways
  AccessibleKitchen
  AccessibleKitchenAppliances
  AccessibleStairway
  AccessibleWasherDryer
  AdaptableBathroomWalls
  AdaptableForElevator
  CeilingTrack
  CentralLivingArea
  CommonArea
  CustomizedWheelchairAccessible
  ElectronicEnvironmentalControls
  EnhancedAccessible
  ExteriorWheelchairLift
  GripAccessibleFeatures
  ReinforcedFloors
  SafeEmergencyEgressFromHome
  SmartTechnology
  StairLift
  StandbyGenerator
  TherapeuticWhirlpool
  Visitable
  VisitorBathroom
  WalkerAccessibleStairs
}

enum Basement {
  Apartment
  BathStubbed
  Block
  Concrete
  CrawlSpace
  Daylight
  DirtFloor
  ExteriorEntry
  Finished
  FrenchDrain
  Full
  InteriorEntry
  None
  Other
  Partial
  PartiallyFinished
  StorageSpace
  SumpPump
  Unfinished
  WalkOutAccess
  WalkUpAccess
}

enum Fencing {
  BackYard
  BarbedWire
  Block
  Brick
  ChainLink
  CrossFenced
  Electric
  Fenced
  FrontYard
  Full
  Gate
  Invisible
  Masonry
  None
  Other
  Partial
  PartialCross
  Perimeter
  Pipe
  Privacy
  Security
  SeeRemarks
  SlumpStone
  SplitRail
  Stone
  Vinyl
  Wire
  Wood
  WroughtIron
}

enum ExpenseCategory {
  ApplicationFee
  BuildingMaintenanceFee
  CapitalImprovementsFee
  CommonAreaMaintenanceFee
  CommunityDevelopmentDistrictFee
  CommunityMasterHomeOwnerFee
  CondoCoopFee
  CoOpFee
  FirstMonthsRent
  HomeOwnerAssessmentsFee
  HomeOwnerTransferFee
  InitiationFee
  KeyDeposit
  LastMonthsRent
  ManagementFee
  Other
  PetDeposit
  POAFee
  RecreationFee
  ReservationFee
  SecurityDeposit
  TennisFee
}

enum ExpenseFrequency {
  Once
  Daily
  Weekly
  BiWeekly
  SemiWeekly
  Monthly
  BiMonthly
  SemiMonthly
  Seasonally
  Quarterly
  BiAnnually
  Annually
  SemiAnnually
  Other
}

enum OpenHouseType {
  Broker
  Office
  Public
  LiveStreamPublic
}

// ---------------------- END PROPERTY ---------------------- //

// ---------------------- START GENERAL ENUMS ---------------------- //

enum Country {
  AD
  AE
  AF
  AG
  AI
  AL
  AM
  AN
  AO
  AQ
  AR
  AS
  AT
  AU
  AW
  AX
  AZ
  BA
  BB
  BD
  BE
  BF
  BG
  BH
  BI
  BJ
  BL
  BM
  BN
  BO
  BR
  BS
  BT
  BV
  BW
  BY
  BZ
  CA
  CC
  CD
  CF
  CG
  CH
  CI
  CK
  CL
  CM
  CN
  CO
  CR
  CU
  CV
  CX
  CY
  CZ
  DE
  DJ
  DK
  DM
  DO
  DZ
  EC
  EE
  EG
  EH
  ER
  ES
  ET
  FI
  FJ
  FK
  FM
  FO
  FR
  GA
  GB
  GD
  GE
  GF
  GG
  GH
  GI
  GL
  GM
  GN
  GP
  GQ
  GR
  GS
  GT
  GU
  GW
  GY
  HK
  HM
  HN
  HR
  HT
  HU
  ID
  IE
  IL
  IM
  IN
  IO
  IQ
  IR
  IS
  IT
  JE
  JM
  JO
  JP
  KE
  KG
  KH
  KI
  KM
  KN
  KP
  KR
  KW
  KY
  KZ
  LA
  LB
  LC
  LI
  LK
  LR
  LS
  LT
  LU
  LV
  LY
  MA
  MC
  MD
  ME
  MF
  MG
  MH
  MK
  ML
  MM
  MN
  MO
  MP
  MQ
  MR
  MS
  MT
  MU
  MV
  MW
  MX
  MY
  MZ
  NA
  NC
  NE
  NF
  NG
  NI
  NL
  NP
  NR
  NU
  NZ
  OM
  OT
  PA
  PE
  PF
  PG
  PH
  PK
  PL
  PM
  PN
  PR
  PS
  PT
  PW
  PY
  QA
  RE
  RO
  RS
  RU
  RW
  SA
  SB
  SC
  SD
  SE
  SG
  SH
  SI
  SJ
  SK
  SL
  SM
  SN
  SO
  SR
  ST
  SV
  SY
  SZ
  TC
  TD
  TF
  TG
  TH
  TJ
  TK
  TL
  TM
  TN
  TO
  TR
  TT
  TV
  TW
  TZ
  UA
  UG
  UM
  US
  UY
  UZ
  VA
  VC
  VE
  VG
  VI
  VN
  VU
  WF
  WS
  YE
  YT
  ZA
  ZM
  ZW
}

enum State {
  AK
  AL
  AR
  AZ
  CA
  CO
  CT
  DC
  DE
  FL
  GA
  HI
  IA
  ID
  IL
  IN
  KS
  KY
  LA
  MA
  MD
  ME
  MI
  MN
  MO
  MS
  MT
  NC
  ND
  NE
  NH
  NJ
  NM
  NV
  NY
  OH
  OK
  OR
  PA
  RI
  SC
  SD
  TN
  TX
  UT
  VA
  VT
  WA
  WI
  WV
  WY
  // Support Puerto Rico as a state or province
  PR
  // Other
  MH
  VI
  PE
  MP
  FM
}

// ---------------------- END GENERAL ENUMS ---------------------- //
janpio commented 1 year ago

Does this also happen when you use a more recent version of Prisma?

kylegwalsh commented 1 year ago

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.

janpio commented 1 year ago

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?

kylegwalsh commented 1 year ago

@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.

janpio commented 1 year ago

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?

kylegwalsh commented 1 year ago

I ran it on the latest stable version of Prisma (4.11.0). Are you referring to the dev builds?

janpio commented 1 year ago

Your original post showed Prisma CLI 4.7.0, which would be what influences the migration.

kylegwalsh commented 1 year ago

@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.

jkomyno commented 1 year ago

[Internal] Here are (1, 2) similar error reports due to quaint for mysql and prisma@4.8.0.

jkomyno commented 1 year ago

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.

kylegwalsh commented 1 year ago

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.

jkomyno commented 1 year ago

Hey @kylegwalsh, I see. Thanks for your reply anyway! We'll see what we can do.

janpio commented 11 months ago

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

Weakky commented 5 months ago

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 :(