Skip to content
Snippets Groups Projects
Commit ef5d3a1d authored by Christian Pointner's avatar Christian Pointner
Browse files

added support for postgresql

parent 2a3f88ef
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,8 @@
name = "github.com/jinzhu/gorm"
packages = [
".",
"dialects/mysql"
"dialects/mysql",
"dialects/postgres"
]
revision = "6ed508ec6a4ecb3531899a69cbc746ccf65a4166"
version = "v1.9.1"
......@@ -58,6 +59,16 @@
packages = ["."]
revision = "04140366298a54a039076d798123ffa108fff46c"
[[projects]]
branch = "master"
name = "github.com/lib/pq"
packages = [
".",
"hstore",
"oid"
]
revision = "90697d60dd844d5ef6ff15135d0203f65d2f53b8"
[[projects]]
name = "google.golang.org/appengine"
packages = ["cloudsql"]
......@@ -73,6 +84,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "9792c451bc4191816229f3c6a2b52889f12e1f976522bd918757ed6746565416"
inputs-digest = "4fda8578e73904c71db697a7016114c7246a4da313f5d0cff8e0a2ebfaa1ce20"
solver-name = "gps-cdcl"
solver-version = 1
......@@ -12,10 +12,10 @@ select * from files;
/* should fail */
insert into playlists () values ();
insert into playlists (created_at) values ('2018-06-17 02:38:17');
/* should succeed */
insert into playlists (group_name) values('test');
insert into playlists (created_at, group_name) values('2018-06-17 02:38:17', 'test');
/* should fail */
......
\dt
select * from __migrations__;
\d groups;
\d files;
\d playlists;
\d playlist_entries;
\connect postgres
drop database tank;
create database tank;
\connect tank
#!/bin/bash
exec docker exec -it aura-postgres psql -U tank
#!/bin/bash
SCRIPTS_D=$(realpath "${BASH_SOURCE%/*}/")
exec docker run -it --rm --name aura-postgres -e POSTGRES_USER=tank -e POSTGRES_PASSWORD=aura -v "$SCRIPTS_D:/scripts:ro" -p 127.0.0.1:5432:5432 postgres:9.6
/* should succeed */
insert into groups (name) values ('test');
/* should fail */
insert into files (size) values(100);
insert into files (group_name, size) values('invalid', 101);
/* should succeed */
insert into files (group_name, size) values('test', 101);
insert into files (group_name, size) values('test', 102);
select * from files;
/* should fail */
insert into playlists (created_at) values ('2018-06-17 02:38:17');
/* should succeed */
insert into playlists (created_at, group_name) values('2018-06-17 02:38:17', 'test');
/* should fail */
insert into playlist_entries (uri) values ('http://stream.example.com/live.mp3');
insert into playlist_entries (playlist_id, uri) values (2, 'http://stream.example.com/live.mp3');
insert into playlist_entries (playlist_id, line_num, uri) values (17, 1, 'http://stream.example.com/live.mp3');
/* should succeed */
insert into playlist_entries (playlist_id, line_num, uri) values (2, 1, 'http://stream.example.com/live.mp3');
/* should fail */
insert into playlist_entries (playlist_id, line_num, uri) values (2, 1, 'http://stream.example.com/other.mp3');
insert into playlist_entries (playlist_id, line_num, file_id) values (2, 4, 23);
/* should succeed */
insert into playlist_entries (playlist_id, line_num, file_id) values (2, 4, 4);
delete from files where id = 3;
/* should fail */
delete from files where id = 4;
/* should succeed */
delete from playlists where id = 2;
delete from files where id = 4;
......@@ -30,7 +30,7 @@ import (
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
// _ "github.com/jinzhu/gorm/dialects/postgres"
_ "github.com/jinzhu/gorm/dialects/postgres"
// _ "github.com/jinzhu/gorm/dialects/sqlite"
// _ "github.com/jinzhu/gorm/dialects/mssql"
)
......
......@@ -34,13 +34,14 @@ import (
// "sort"
"testing"
// "time"
// "github.com/coreos/bbolt"
)
var (
testBasePath = "run/aura-tank_testing"
testDBType = "mysql"
testDBConnection = "tank:aura@tcp(127.0.0.1:3306)/tank?charset=utf8&parseTime=True&loc=Local"
testBasePath = "run/aura-tank_testing"
// testDBType = "mysql"
// testDBConnection = "tank:aura@tcp(127.0.0.1:3306)/tank?charset=utf8&parseTime=True&loc=Local"
testDBType = "postgres"
testDBConnection = "host=127.0.0.1 port=5432 user=tank dbname=tank password=aura sslmode=disable"
testGroup1 = "test1"
testGroup2 = "test2"
testUser1 = "user1"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment