Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python3 schema diff to output as str #49

Closed
wants to merge 1 commit into from
Closed

Conversation

karenc
Copy link
Owner

@karenc karenc commented Sep 25, 2017

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.

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
Copy link

Coverage Status

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

@karenc
Copy link
Owner Author

karenc commented Sep 25, 2017

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

@karenc karenc closed this Sep 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants