File tree Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change 35
35
name : Installing top-level dependencies
36
36
command : |
37
37
export PATH=~/.local/bin:$PATH
38
- pip install --user tox poetry
38
+ pip install --user tox poetry psycopg2-binary
39
39
- run :
40
40
name : Waiting for Postgres to start up
41
41
command : |
46
46
sleep 1
47
47
done
48
48
echo Failed waiting for Postgres && exit 1
49
+ - run :
50
+ name : Creating Postgres database and ltree extension
51
+ command : |
52
+ python -c "
53
+ import psycopg2, os
54
+ from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
55
+
56
+ def getcur(dbname):
57
+ conn = psycopg2.connect(
58
+ dbname=dbname,
59
+ host=os.environ['PG_HOST'],
60
+ user=os.environ['PG_USER'],
61
+ password=os.environ['PG_PASSWORD'],
62
+ )
63
+ conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
64
+ return conn.cursor()
65
+
66
+ cur = getcur('postgres')
67
+ cur.execute('CREATE DATABASE \"django-pgtree-test\"')
68
+ cur = getcur('django-pgtree-test')
69
+ cur.execute('CREATE EXTENSION ltree')"
49
70
- run :
50
71
name : Running tests
51
72
command : |
Original file line number Diff line number Diff line change 37
37
"django.contrib.sessions" ,
38
38
"django.contrib.messages" ,
39
39
"django.contrib.staticfiles" ,
40
- # In this case we're creating the ltree extension in a migration,
41
- # so it needs to come before django_pgtree (which does a CREATE
42
- # FUNCTION that uses ltree in its migrations)
43
40
"testproject.testapp" ,
44
41
"django_pgtree" ,
45
42
]
84
81
"HOST" : os .environ .get ("PG_HOST" , "" ),
85
82
"USER" : os .environ .get ("PG_USER" , "" ),
86
83
"PASSWORD" : os .environ .get ("PG_PASSWORD" , "" ),
84
+ "TEST" : {"TEMPLATE" : "template1" , "NAME" : "django-pgtree-test" },
87
85
}
88
86
}
89
87
Original file line number Diff line number Diff line change @@ -12,9 +12,6 @@ class Migration(migrations.Migration):
12
12
dependencies = []
13
13
14
14
operations = [
15
- migrations .RunSQL (
16
- "CREATE EXTENSION IF NOT EXISTS ltree" , migrations .RunSQL .noop
17
- ),
18
15
migrations .CreateModel (
19
16
name = "TestModel" ,
20
17
fields = [
You can’t perform that action at this time.
0 commit comments