Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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();
        }