title: Grails: Cannot delete or update a parent row: a foreign key constraint fails
body: <p>So I have 2 tables in grails domain class one is Customer and another one is Customer Client.Customer client have a foreign key of Customer. Here is the code for my Customer domain:</p>
  <pre><code>
  class Customer {
      String code
      String name
      String contactPerson
      String status
  
  
      static hasOne = [customerClient: CustomerClient]
  
      static constraints = {
          status maxSize:8
          contactPerson nullable: true
          name nullable: false
          status nullabale: false
          customerClient nullable: true
      }
  }
  </code></pre>
  <p>and here is the code for my Customer Client domain:</p>
  <pre><code>package workdatabase4
  
  class CustomerClient {
      String zendeskApiToken
      String zendeskUrl
      String clientChannelId
      String clientName
      String clientChannel
      String status
      String zendeskApiAuth
      String channelAccessToken
  
      static belongsTo = [customer: Customer]
  
      static constraints = {
          clientName nullable: true
      }
  }
  
  </code></pre>
  <p>I do not have a delete function in my controller,I just tried to delete it manually through the database in intellij and I got this error:</p>
  <pre><code>[23000][1451] Cannot delete or update a parent row: a foreign key constraint fails (`customerclient`.`customer_client`, CONSTRAINT `FKgobbh6gqke89v6a7rdsfcdu2o` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`))
  </code></pre>
  <p>My question is how can I delete Customer without deleting the Customer Client first?
  Thank you.</p>