# _Migration

name: watch-20200813062410
status: MigrationSuccess
errors: []
datamodel:
  datasource db {
    provider = "sqlite"
    url      = "***"
  }

  model User {
    id         String   @default(cuid()) @id
    email      String   @unique
    name       String?
    age        Int?
    posts      Post[]
    likes      Like[]
    property   Property @relation(fields: [propertyId], references: [id])
    propertyId String
  }

  model Property {
    id      String @default(cuid()) @id
    house   House  @relation(fields: [houseId], references: [id])
    users   User[]
    houseId String
  }

  model House {
    id         String     @default(cuid()) @id
    like       Like       @relation(fields: [likeId], references: [id])
    properties Property[]
    likeId     String
  }

  model Post {
    id        String   @default(cuid()) @id
    createdAt DateTime @default(now())
    updatedAt DateTime @updatedAt
    published Boolean
    title     String
    content   String?
    authorId  String?
    author    User?    @relation(fields: [authorId], references: [id])
    Like      Like[]
  }

  model Like {
    id     String  @default(cuid()) @id
    userId String
    user   User    @relation(fields: [userId], references: [id])
    postId String
    post   Post    @relation(fields: [postId], references: [id])
    House  House[]

    @@unique([userId, postId])
  }

datamodel_steps:
  [{"tag":"CreateSource","source":"db"},{"tag":"CreateArgument","location":{"tag":"Source","source":"db"},"argument":"provider","value":"\"sqlite\""},{"tag":"CreateArgument","location":{"tag":"Source","source":"db"},"argument":"url","value":"\"***\""},{"tag":"CreateModel","model":"User"},{"tag":"CreateField","model":"User","field":"id","type":"String","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"User","field":"id"},"directive":"default"}},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"User","field":"id"},"directive":"default"},"argument":"","value":"cuid()"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"User","field":"id"},"directive":"id"}},{"tag":"CreateField","model":"User","field":"email","type":"String","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"User","field":"email"},"directive":"unique"}},{"tag":"CreateField","model":"User","field":"name","type":"String","arity":"Optional"},{"tag":"CreateField","model":"User","field":"age","type":"Int","arity":"Optional"},{"tag":"CreateField","model":"User","field":"posts","type":"Post","arity":"List"},{"tag":"CreateField","model":"User","field":"likes","type":"Like","arity":"List"},{"tag":"CreateField","model":"User","field":"property","type":"Property","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"User","field":"property"},"directive":"relation"}},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"User","field":"property"},"directive":"relation"},"argument":"fields","value":"[propertyId]"},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"User","field":"property"},"directive":"relation"},"argument":"references","value":"[id]"},{"tag":"CreateField","model":"User","field":"propertyId","type":"String","arity":"Required"},{"tag":"CreateModel","model":"Property"},{"tag":"CreateField","model":"Property","field":"id","type":"String","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"Property","field":"id"},"directive":"default"}},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"Property","field":"id"},"directive":"default"},"argument":"","value":"cuid()"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"Property","field":"id"},"directive":"id"}},{"tag":"CreateField","model":"Property","field":"house","type":"House","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"Property","field":"house"},"directive":"relation"}},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"Property","field":"house"},"directive":"relation"},"argument":"fields","value":"[houseId]"},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"Property","field":"house"},"directive":"relation"},"argument":"references","value":"[id]"},{"tag":"CreateField","model":"Property","field":"users","type":"User","arity":"List"},{"tag":"CreateField","model":"Property","field":"houseId","type":"String","arity":"Required"},{"tag":"CreateModel","model":"House"},{"tag":"CreateField","model":"House","field":"id","type":"String","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"House","field":"id"},"directive":"default"}},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"House","field":"id"},"directive":"default"},"argument":"","value":"cuid()"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"House","field":"id"},"directive":"id"}},{"tag":"CreateField","model":"House","field":"like","type":"Like","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"House","field":"like"},"directive":"relation"}},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"House","field":"like"},"directive":"relation"},"argument":"fields","value":"[likeId]"},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"House","field":"like"},"directive":"relation"},"argument":"references","value":"[id]"},{"tag":"CreateField","model":"House","field":"properties","type":"Property","arity":"List"},{"tag":"CreateField","model":"House","field":"likeId","type":"String","arity":"Required"},{"tag":"CreateModel","model":"Post"},{"tag":"CreateField","model":"Post","field":"id","type":"String","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"Post","field":"id"},"directive":"default"}},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"Post","field":"id"},"directive":"default"},"argument":"","value":"cuid()"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"Post","field":"id"},"directive":"id"}},{"tag":"CreateField","model":"Post","field":"createdAt","type":"DateTime","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"Post","field":"createdAt"},"directive":"default"}},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"Post","field":"createdAt"},"directive":"default"},"argument":"","value":"now()"},{"tag":"CreateField","model":"Post","field":"updatedAt","type":"DateTime","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"Post","field":"updatedAt"},"directive":"updatedAt"}},{"tag":"CreateField","model":"Post","field":"published","type":"Boolean","arity":"Required"},{"tag":"CreateField","model":"Post","field":"title","type":"String","arity":"Required"},{"tag":"CreateField","model":"Post","field":"content","type":"String","arity":"Optional"},{"tag":"CreateField","model":"Post","field":"authorId","type":"String","arity":"Optional"},{"tag":"CreateField","model":"Post","field":"author","type":"User","arity":"Optional"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"Post","field":"author"},"directive":"relation"}},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"Post","field":"author"},"directive":"relation"},"argument":"fields","value":"[authorId]"},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"Post","field":"author"},"directive":"relation"},"argument":"references","value":"[id]"},{"tag":"CreateField","model":"Post","field":"Like","type":"Like","arity":"List"},{"tag":"CreateModel","model":"Like"},{"tag":"CreateField","model":"Like","field":"id","type":"String","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"Like","field":"id"},"directive":"default"}},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"Like","field":"id"},"directive":"default"},"argument":"","value":"cuid()"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"Like","field":"id"},"directive":"id"}},{"tag":"CreateField","model":"Like","field":"userId","type":"String","arity":"Required"},{"tag":"CreateField","model":"Like","field":"user","type":"User","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"Like","field":"user"},"directive":"relation"}},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"Like","field":"user"},"directive":"relation"},"argument":"fields","value":"[userId]"},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"Like","field":"user"},"directive":"relation"},"argument":"references","value":"[id]"},{"tag":"CreateField","model":"Like","field":"postId","type":"String","arity":"Required"},{"tag":"CreateField","model":"Like","field":"post","type":"Post","arity":"Required"},{"tag":"CreateDirective","location":{"path":{"tag":"Field","model":"Like","field":"post"},"directive":"relation"}},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"Like","field":"post"},"directive":"relation"},"argument":"fields","value":"[postId]"},{"tag":"CreateArgument","location":{"tag":"Directive","path":{"tag":"Field","model":"Like","field":"post"},"directive":"relation"},"argument":"references","value":"[id]"},{"tag":"CreateField","model":"Like","field":"House","type":"House","arity":"List"},{"tag":"CreateDirective","location":{"path":{"tag":"Model","model":"Like","arguments":[{"name":"","value":"[userId, postId]"}]},"directive":"unique"}}]

database_migration:
  {"before":{"tables":[{"name":"_Migration","columns":[{"name":"revision","tpe":{"dataType":"INTEGER","fullDataType":"INTEGER","characterMaximumLength":null,"family":"int","arity":"required"},"default":null,"autoIncrement":true},{"name":"name","tpe":{"dataType":"TEXT","fullDataType":"TEXT","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"datamodel","tpe":{"dataType":"TEXT","fullDataType":"TEXT","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"status","tpe":{"dataType":"TEXT","fullDataType":"TEXT","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"applied","tpe":{"dataType":"INTEGER","fullDataType":"INTEGER","characterMaximumLength":null,"family":"int","arity":"required"},"default":null,"autoIncrement":false},{"name":"rolled_back","tpe":{"dataType":"INTEGER","fullDataType":"INTEGER","characterMaximumLength":null,"family":"int","arity":"required"},"default":null,"autoIncrement":false},{"name":"datamodel_steps","tpe":{"dataType":"TEXT","fullDataType":"TEXT","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"database_migration","tpe":{"dataType":"TEXT","fullDataType":"TEXT","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"errors","tpe":{"dataType":"TEXT","fullDataType":"TEXT","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"started_at","tpe":{"dataType":"DATE","fullDataType":"DATE","characterMaximumLength":null,"family":"dateTime","arity":"required"},"default":null,"autoIncrement":false},{"name":"finished_at","tpe":{"dataType":"DATE","fullDataType":"DATE","characterMaximumLength":null,"family":"dateTime","arity":"nullable"},"default":null,"autoIncrement":false}],"indices":[],"primaryKey":{"columns":["revision"],"sequence":null,"constraintName":null},"foreignKeys":[]}],"enums":[],"sequences":[]},"after":{"tables":[{"name":"User","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"email","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"name","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"nullable"},"default":null,"autoIncrement":false},{"name":"age","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"int","arity":"nullable"},"default":null,"autoIncrement":false},{"name":"propertyId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false}],"indices":[{"name":"User.email_unique","columns":["email"],"tpe":"unique"}],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["propertyId"],"referencedTable":"Property","referencedColumns":["id"],"onDeleteAction":"cascade"}]},{"name":"Property","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"houseId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false}],"indices":[],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["houseId"],"referencedTable":"House","referencedColumns":["id"],"onDeleteAction":"cascade"}]},{"name":"House","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"likeId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false}],"indices":[],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["likeId"],"referencedTable":"Like","referencedColumns":["id"],"onDeleteAction":"cascade"}]},{"name":"Post","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"createdAt","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"dateTime","arity":"required"},"default":"NOW","autoIncrement":false},{"name":"updatedAt","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"dateTime","arity":"required"},"default":null,"autoIncrement":false},{"name":"published","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"boolean","arity":"required"},"default":null,"autoIncrement":false},{"name":"title","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"content","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"nullable"},"default":null,"autoIncrement":false},{"name":"authorId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"nullable"},"default":null,"autoIncrement":false}],"indices":[],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["authorId"],"referencedTable":"User","referencedColumns":["id"],"onDeleteAction":"setNull"}]},{"name":"Like","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"userId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"postId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false}],"indices":[{"name":"Like.userId_postId_unique","columns":["userId","postId"],"tpe":"unique"}],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["userId"],"referencedTable":"User","referencedColumns":["id"],"onDeleteAction":"cascade"},{"constraintName":null,"columns":["postId"],"referencedTable":"Post","referencedColumns":["id"],"onDeleteAction":"cascade"}]}],"enums":[],"sequences":[]},"original_steps":[{"CreateTable":{"table":{"name":"User","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"email","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"name","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"nullable"},"default":null,"autoIncrement":false},{"name":"age","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"int","arity":"nullable"},"default":null,"autoIncrement":false},{"name":"propertyId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false}],"indices":[{"name":"User.email_unique","columns":["email"],"tpe":"unique"}],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["propertyId"],"referencedTable":"Property","referencedColumns":["id"],"onDeleteAction":"cascade"}]}}},{"CreateTable":{"table":{"name":"Property","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"houseId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false}],"indices":[],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["houseId"],"referencedTable":"House","referencedColumns":["id"],"onDeleteAction":"cascade"}]}}},{"CreateTable":{"table":{"name":"House","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"likeId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false}],"indices":[],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["likeId"],"referencedTable":"Like","referencedColumns":["id"],"onDeleteAction":"cascade"}]}}},{"CreateTable":{"table":{"name":"Post","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"createdAt","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"dateTime","arity":"required"},"default":"NOW","autoIncrement":false},{"name":"updatedAt","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"dateTime","arity":"required"},"default":null,"autoIncrement":false},{"name":"published","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"boolean","arity":"required"},"default":null,"autoIncrement":false},{"name":"title","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"content","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"nullable"},"default":null,"autoIncrement":false},{"name":"authorId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"nullable"},"default":null,"autoIncrement":false}],"indices":[],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["authorId"],"referencedTable":"User","referencedColumns":["id"],"onDeleteAction":"setNull"}]}}},{"CreateTable":{"table":{"name":"Like","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"userId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"postId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false}],"indices":[{"name":"Like.userId_postId_unique","columns":["userId","postId"],"tpe":"unique"}],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["userId"],"referencedTable":"User","referencedColumns":["id"],"onDeleteAction":"cascade"},{"constraintName":null,"columns":["postId"],"referencedTable":"Post","referencedColumns":["id"],"onDeleteAction":"cascade"}]}}},{"CreateIndex":{"table":"User","index":{"name":"User.email_unique","columns":["email"],"tpe":"unique"}}},{"CreateIndex":{"table":"Like","index":{"name":"Like.userId_postId_unique","columns":["userId","postId"],"tpe":"unique"}}},{"AddForeignKey":{"table":"User","foreign_key":{"constraintName":null,"columns":["propertyId"],"referencedTable":"Property","referencedColumns":["id"],"onDeleteAction":"cascade"}}},{"AddForeignKey":{"table":"Property","foreign_key":{"constraintName":null,"columns":["houseId"],"referencedTable":"House","referencedColumns":["id"],"onDeleteAction":"cascade"}}},{"AddForeignKey":{"table":"House","foreign_key":{"constraintName":null,"columns":["likeId"],"referencedTable":"Like","referencedColumns":["id"],"onDeleteAction":"cascade"}}},{"AddForeignKey":{"table":"Post","foreign_key":{"constraintName":null,"columns":["authorId"],"referencedTable":"User","referencedColumns":["id"],"onDeleteAction":"setNull"}}},{"AddForeignKey":{"table":"Like","foreign_key":{"constraintName":null,"columns":["userId"],"referencedTable":"User","referencedColumns":["id"],"onDeleteAction":"cascade"}}},{"AddForeignKey":{"table":"Like","foreign_key":{"constraintName":null,"columns":["postId"],"referencedTable":"Post","referencedColumns":["id"],"onDeleteAction":"cascade"}}}],"corrected_steps":[{"RawSql":{"raw":"PRAGMA foreign_keys=OFF;"}},{"CreateTable":{"table":{"name":"User","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"email","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"name","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"nullable"},"default":null,"autoIncrement":false},{"name":"age","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"int","arity":"nullable"},"default":null,"autoIncrement":false},{"name":"propertyId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false}],"indices":[{"name":"User.email_unique","columns":["email"],"tpe":"unique"}],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["propertyId"],"referencedTable":"Property","referencedColumns":["id"],"onDeleteAction":"cascade"}]}}},{"CreateTable":{"table":{"name":"Property","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"houseId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false}],"indices":[],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["houseId"],"referencedTable":"House","referencedColumns":["id"],"onDeleteAction":"cascade"}]}}},{"CreateTable":{"table":{"name":"House","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"likeId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false}],"indices":[],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["likeId"],"referencedTable":"Like","referencedColumns":["id"],"onDeleteAction":"cascade"}]}}},{"CreateTable":{"table":{"name":"Post","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"createdAt","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"dateTime","arity":"required"},"default":"NOW","autoIncrement":false},{"name":"updatedAt","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"dateTime","arity":"required"},"default":null,"autoIncrement":false},{"name":"published","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"boolean","arity":"required"},"default":null,"autoIncrement":false},{"name":"title","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"content","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"nullable"},"default":null,"autoIncrement":false},{"name":"authorId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"nullable"},"default":null,"autoIncrement":false}],"indices":[],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["authorId"],"referencedTable":"User","referencedColumns":["id"],"onDeleteAction":"setNull"}]}}},{"CreateTable":{"table":{"name":"Like","columns":[{"name":"id","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"userId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false},{"name":"postId","tpe":{"dataType":"","fullDataType":"","characterMaximumLength":null,"family":"string","arity":"required"},"default":null,"autoIncrement":false}],"indices":[{"name":"Like.userId_postId_unique","columns":["userId","postId"],"tpe":"unique"}],"primaryKey":{"columns":["id"],"sequence":null,"constraintName":null},"foreignKeys":[{"constraintName":null,"columns":["userId"],"referencedTable":"User","referencedColumns":["id"],"onDeleteAction":"cascade"},{"constraintName":null,"columns":["postId"],"referencedTable":"Post","referencedColumns":["id"],"onDeleteAction":"cascade"}]}}},{"CreateIndex":{"table":"User","index":{"name":"User.email_unique","columns":["email"],"tpe":"unique"}}},{"CreateIndex":{"table":"Like","index":{"name":"Like.userId_postId_unique","columns":["userId","postId"],"tpe":"unique"}}},{"AddForeignKey":{"table":"User","foreign_key":{"constraintName":null,"columns":["propertyId"],"referencedTable":"Property","referencedColumns":["id"],"onDeleteAction":"cascade"}}},{"AddForeignKey":{"table":"Property","foreign_key":{"constraintName":null,"columns":["houseId"],"referencedTable":"House","referencedColumns":["id"],"onDeleteAction":"cascade"}}},{"AddForeignKey":{"table":"House","foreign_key":{"constraintName":null,"columns":["likeId"],"referencedTable":"Like","referencedColumns":["id"],"onDeleteAction":"cascade"}}},{"AddForeignKey":{"table":"Post","foreign_key":{"constraintName":null,"columns":["authorId"],"referencedTable":"User","referencedColumns":["id"],"onDeleteAction":"setNull"}}},{"AddForeignKey":{"table":"Like","foreign_key":{"constraintName":null,"columns":["userId"],"referencedTable":"User","referencedColumns":["id"],"onDeleteAction":"cascade"}}},{"AddForeignKey":{"table":"Like","foreign_key":{"constraintName":null,"columns":["postId"],"referencedTable":"Post","referencedColumns":["id"],"onDeleteAction":"cascade"}}},{"RawSql":{"raw":"PRAGMA \"quaint\".foreign_key_check;"}},{"RawSql":{"raw":"PRAGMA foreign_keys=ON;"}}],"rollback":[{"RawSql":{"raw":"PRAGMA foreign_keys=OFF;"}},{"DropTable":{"name":"User"}},{"DropTable":{"name":"Property"}},{"DropTable":{"name":"House"}},{"DropTable":{"name":"Post"}},{"DropTable":{"name":"Like"}},{"RawSql":{"raw":"PRAGMA \"quaint\".foreign_key_check;"}},{"RawSql":{"raw":"PRAGMA foreign_keys=ON;"}}]}


