make conversation-id deterministic (#154)
[akkoma] / priv / repo / optional_migrations / destructive / remove_null_object_type_records / 20220806014830_remove_null_objects.exs
diff --git a/priv/repo/optional_migrations/destructive/remove_null_object_type_records/20220806014830_remove_null_objects.exs b/priv/repo/optional_migrations/destructive/remove_null_object_type_records/20220806014830_remove_null_objects.exs
new file mode 100644 (file)
index 0000000..308c3db
--- /dev/null
@@ -0,0 +1,14 @@
+defmodule Pleroma.Repo.Migrations.RemoveNullObjects do
+  use Ecto.Migration
+
+  def up do
+    statement = """
+    DELETE FROM objects
+    WHERE (data->>'type') is null;
+    """
+
+    execute(statement)
+  end
+
+  def down, do: :ok
+end