Skip to content

Commit

Permalink
Add experimental postgres backend to GitRekt.Git
Browse files Browse the repository at this point in the history
See #2 for more details.
  • Loading branch information
redrabbit committed Apr 15, 2019
1 parent 03023d7 commit 5d8a2b3
Show file tree
Hide file tree
Showing 10 changed files with 692 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
defmodule GitGud.DB.Migrations.AddGitObjectsTable do
use Ecto.Migration

def change do
create table("git_objects", primary_key: false) do
add :oid, :binary, primary_key: true
add :repo_id, references("repositories", on_delete: :delete_all), primary_key: true
add :type, :integer, null: false
add :size, :integer, null: false
add :data, :binary
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
defmodule GitGud.DB.Migrations.AddGitReferencesTable do
use Ecto.Migration

def change do
create table("git_references", primary_key: false) do
add :name, :string, primary_key: true
add :repo_id, references("repositories", on_delete: :delete_all), primary_key: true
add :symlink, :string
add :oid, :binary
end
end
end
2 changes: 1 addition & 1 deletion apps/gitrekt/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ERLANG_PATH ?= $(shell erl -eval 'io:format("~s", [lists:concat([code:root_dir(), "/erts-", erlang:system_info(version), "/include"])])' -s init stop -noshell)
CFLAGS ?= -O2 -Wall -Wextra -Wno-unused-parameter -I$(ERLANG_PATH)
LDFLAGS += -lgit2
LDFLAGS += -lgit2 -lpq

ifneq ($(OS),Windows_NT)
CFLAGS += -fPIC
Expand Down
1 change: 1 addition & 0 deletions apps/gitrekt/c_src/geef.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ static ErlNifFunc geef_funcs[] =
{
{"repository_init", 2, geef_repository_init, 0},
{"repository_open", 1, geef_repository_open, 0},
{"repository_open_postgres", 2, geef_repository_open_postgres, 0},
{"repository_discover", 1, geef_repository_discover, 0},
{"repository_bare?", 1, geef_repository_is_bare, 0},
{"repository_empty?", 1, geef_repository_is_empty, 0},
Expand Down
Loading

0 comments on commit 5d8a2b3

Please sign in to comment.