示例#1
0
        // TODO -- have this take in CommandBuilder
        public string UpdateSqlFragment()
        {
            var jsonField = new JsonLocatorField("d.data", _enumStorage, Casing.Default, Members);
            // HOKEY, but I'm letting it pass for now.
            var sqlLocator = jsonField.SqlLocator.Replace("d.", "");

            return($"{ColumnName} = {sqlLocator}");
        }
示例#2
0
        // TODO -- think this one might have to change w/ FK's
        public void WritePatch(DocumentMapping mapping, IDDLRunner runner)
        {
            runner.Apply(mapping, $"ALTER TABLE {mapping.Table.QualifiedName} ADD COLUMN {ColumnName} {PgType};");

            var jsonField = new JsonLocatorField(_enumStorage, Members);

            // HOKEY, but I'm letting it pass for now.
            var sqlLocator = jsonField.SqlLocator.Replace("d.", "");

            runner.Apply(mapping, $"update {mapping.Table.QualifiedName} set {ColumnName} = {sqlLocator}");
        }
示例#3
0
        // TODO -- think this one might have to change w/ FK's
        public void WritePatch(DocumentMapping mapping, Action <string> executeSql)
        {
            executeSql($"ALTER TABLE {mapping.Table.QualifiedName} ADD COLUMN {ColumnName} {PgType};");

            var jsonField = new JsonLocatorField(_enumStorage, Members);

            // HOKEY, but I'm letting it pass for now.
            var sqlLocator = jsonField.SqlLocator.Replace("d.", "");

            executeSql($"update {mapping.Table.QualifiedName} set {ColumnName} = {sqlLocator}");
        }
示例#4
0
 // TODO -- have this take in CommandBuilder
 public string UpdateSqlFragment()
 {
     if ((DbType & NpgsqlDbType.Array) == NpgsqlDbType.Array && PgType != "jsonb")
     {
         var jsonField = new JsonLocatorField("data", new StoreOptions(), _enumStorage, Casing.Default, Members, "jsonb");
         return($"{ColumnName} = CAST(ARRAY(SELECT jsonb_array_elements_text({jsonField.SqlLocator})) as {PgType})");
     }
     else
     {
         var jsonField = new JsonLocatorField("data", new StoreOptions(), _enumStorage, Casing.Default, Members, PgType);
         return($"{ColumnName} = {jsonField.SqlLocator}");
     }
 }