karenc / db-migrator

GNU Affero General Public License v3.0
4 stars 5 forks source link

Fix python3 schema diff to output as str #49

Closed karenc closed 7 years ago

karenc commented 7 years ago

When running migrations in python3, the schema diff is displayed:

Running migration 20170810093842 create_a_table
b"--- \n+++ \n@@ -38,20 +38,31 @@\n $$;\n \n \n ALTER FUNCTION public.karen_trigger() OWNER TO travis;\n \n SET default_tablespace = '';\n \n SET default_with_oids = false;\n \n --\n+-- Name: a_table; Type: TABLE; Schema: public; Owner: travis; Tablespace: \n+--\n+\n+CREATE TABLE a_table (\n+    name text\n+);\n+\n+\n+ALTER TABLE a_table OWNER TO travis;\n+\n+--\n -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: travis; Tablespace: \n --\n \n CREATE TABLE schema_migrations (\n     version text NOT NULL,\n     applied timestamp with time zone DEFAULT now()\n );\n \n \n ALTER TABLE schema_migrations OWNER TO travis;\n"

str and byte are mixed together causing the output to be hard to read.

Change schema diff to display as str.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.0%) to 96.158% when pulling d904bd5eea8bc643bd4ec1881ecf46d5eeacfeee on py3-schema-diff into 78a3d3f13ffd5dc9aa41b8481a2d477d603f71ea on master.

karenc commented 7 years ago

Python 2 tests are failing because testing.py uses BytesIO to capture stdout...