Skip to content

Commit

Permalink
Merge pull request #355 from Marlysson/fix/double-type-postgres
Browse files Browse the repository at this point in the history
Fix double type in postgres. Changed to double precision.
  • Loading branch information
josephmancuso authored Feb 3, 2021
2 parents c65b272 + 1e9fd75 commit 36e622e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/masoniteorm/schema/platforms/PostgresPlatform.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PostgresPlatform(Platform):
"binary": "LONGBLOB",
"boolean": "BOOLEAN",
"decimal": "DECIMAL",
"double": "DOUBLE",
"double": "DOUBLE PRECISION",
"enum": "VARCHAR(255) CHECK ",
"text": "TEXT",
"float": "FLOAT",
Expand Down
5 changes: 3 additions & 2 deletions tests/postgres/schema/test_postgres_schema_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,21 @@ def test_can_advanced_table_creation2(self):
blueprint.datetime("published_at")
blueprint.string("thumbnail").nullable()
blueprint.integer("premium")
blueprint.double("amount").default(0.0)
blueprint.integer("author_id").unsigned().nullable()
blueprint.foreign("author_id").references("id").on("authors").on_delete(
"CASCADE"
)
blueprint.text("description")
blueprint.timestamps()

self.assertEqual(len(blueprint.table.added_columns), 14)
self.assertEqual(len(blueprint.table.added_columns), 15)
self.assertEqual(
blueprint.to_sql(),
(
'CREATE TABLE "users" (id SERIAL UNIQUE NOT NULL, name VARCHAR(255) NOT NULL, '
"duration VARCHAR(255) NOT NULL, money DECIMAL(17, 6) NOT NULL, url VARCHAR(255) NOT NULL, option VARCHAR(255) NOT NULL DEFAULT 'ADMIN', payload JSONB NOT NULL, published_at TIMESTAMP NOT NULL, "
"thumbnail VARCHAR(255) NULL, premium INTEGER NOT NULL, author_id INT NULL, "
"thumbnail VARCHAR(255) NULL, premium INTEGER NOT NULL, amount DOUBLE PRECISION NOT NULL DEFAULT 0.0, author_id INT NULL, "
"description TEXT NOT NULL, created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, "
"updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, "
"CONSTRAINT users_author_id_foreign FOREIGN KEY (author_id) REFERENCES authors(id))"
Expand Down

0 comments on commit 36e622e

Please sign in to comment.