Skip to content

Commit 03b3b8d

Browse files
authored
Merge pull request #17 from goby-lang/drop-plugin
Drop PluginPG
2 parents 582b178 + 6129d26 commit 03b3b8d

File tree

2 files changed

+16
-71
lines changed

2 files changed

+16
-71
lines changed

model.gb

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
require_relative "plugin"
1+
require "db"
22

3-
PluginPG.run("create table if not exists list_items (
3+
# Some PG settings
4+
db_user = ENV["POSTGRES_USER"] || "postgres"
5+
db_name = ENV["POSTGRES_DB"] || "goby_test"
6+
db_host = ENV["POSTGRES_HOST"] || "0.0.0.0"
7+
8+
pg_host = ENV["DATABASE_URL"]
9+
10+
if pg_host.nil?
11+
pg_host = String.fmt("user=%s dbname=%s host=%s sslmode=disable", db_user, db_name, db_host)
12+
end
13+
14+
PG = DB.open("postgres", pg_host)
15+
16+
PG.run("create table if not exists list_items (
417
id serial primary key,
518
title varchar(40),
619
checked boolean
@@ -40,7 +53,7 @@ class ListItem
4053

4154

4255
def self.plugin_db
43-
PluginPG
56+
PG
4457
end
4558

4659
def self.all

plugin.gb

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)