Skip to content

Commit

Permalink
added more decimal tests
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmancuso committed Jan 21, 2021
1 parent 79302bf commit 02f19ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions tests/mysql/schema/test_mysql_schema_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,18 @@ def test_can_advanced_table_creation(self):
blueprint.string("name")
blueprint.string("email").unique()
blueprint.string("password")
blueprint.decimal("money")
blueprint.integer("admin").default(0)
blueprint.string("remember_token").nullable()
blueprint.timestamp("verified_at").nullable()
blueprint.timestamps()

self.assertEqual(len(blueprint.table.added_columns), 9)
self.assertEqual(len(blueprint.table.added_columns), 10)
self.assertEqual(
blueprint.to_sql(),
(
"CREATE TABLE users (id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, "
"name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, "
"name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, money DECIMAL(17, 6) NOT NULL, "
"admin INT(11) NOT NULL DEFAULT 0, remember_token VARCHAR(255) NULL, verified_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, "
"created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, CONSTRAINT users_email_unique UNIQUE (email))"
),
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 @@ -112,6 +112,7 @@ def test_can_advanced_table_creation2(self):
blueprint.increments("id")
blueprint.string("name")
blueprint.string("duration")
blueprint.decimal("money")
blueprint.string("url")
blueprint.datetime("published_at")
blueprint.string("thumbnail").nullable()
Expand All @@ -123,12 +124,12 @@ def test_can_advanced_table_creation2(self):
blueprint.text("description")
blueprint.timestamps()

self.assertEqual(len(blueprint.table.added_columns), 11)
self.assertEqual(len(blueprint.table.added_columns), 12)
self.assertEqual(
blueprint.to_sql(),
(
'CREATE TABLE "users" (id SERIAL UNIQUE NOT NULL, name VARCHAR(255) NOT NULL, '
"duration VARCHAR(255) NOT NULL, url VARCHAR(255) NOT NULL, published_at TIMESTAMP NOT NULL, "
"duration VARCHAR(255) NOT NULL, money DECIMAL(17, 6) NOT NULL, url VARCHAR(255) NOT NULL, published_at TIMESTAMP NOT NULL, "
"thumbnail VARCHAR(255) NULL, premium INTEGER NOT NULL, author_id INT NULL, "
"description TEXT NOT NULL, created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, "
"updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, "
Expand Down

0 comments on commit 02f19ec

Please sign in to comment.