Skip to content

Commit

Permalink
Merge pull request #441 from rodrigopv/fix/440
Browse files Browse the repository at this point in the history
Fix #440: Store binary data type in PostgreSQL
  • Loading branch information
josephmancuso committed Apr 12, 2021
2 parents 86a49cd + a75bc2e commit 1d10bfb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/masoniteorm/schema/platforms/PostgresPlatform.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PostgresPlatform(Platform):
"medium_integer": "MEDIUMINT",
"increments": "SERIAL UNIQUE",
"uuid": "CHAR",
"binary": "LONGBLOB",
"binary": "BYTEA",
"boolean": "BOOLEAN",
"decimal": "DECIMAL",
"double": "DOUBLE PRECISION",
Expand Down
10 changes: 10 additions & 0 deletions tests/postgres/schema/test_postgres_schema_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,16 @@ def test_can_add_other_integer_types_column(self):
'CREATE TABLE "integer_types" (tiny TINYINT NOT NULL, small SMALLINT NOT NULL, medium MEDIUMINT NOT NULL, big BIGINT NOT NULL)',
)

def test_can_add_binary_column(self):
with self.schema.create("binary_storing") as table:
table.binary("filecontent")

self.assertEqual(len(table.table.added_columns), 1)
self.assertEqual(
table.to_sql(),
'CREATE TABLE "binary_storing" (filecontent BYTEA NOT NULL)',
)

def test_can_enable_foreign_keys(self):
sql = self.schema.enable_foreign_key_constraints()

Expand Down

0 comments on commit 1d10bfb

Please sign in to comment.