private bool shouldRegenerate(IDocumentMapping mapping) { if (!DocumentTables().Contains(mapping.TableName)) { return(true); } var existing = TableSchema(mapping.TableName); var expected = mapping.ToTable(this); return(!expected.Equals(existing)); }
public static void WriteSchemaObjects(IDocumentMapping mapping, IDocumentSchema schema, StringWriter writer) { var table = mapping.ToTable(schema); table.Write(writer); writer.WriteLine(); writer.WriteLine(); mapping.ToUpsertFunction().WriteFunctionSql(schema?.UpsertType ?? PostgresUpsertType.Legacy, writer); mapping.Indexes.Each(x => { writer.WriteLine(); writer.WriteLine(x.ToDDL()); }); writer.WriteLine(); writer.WriteLine(); }