nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: sdispater/pendulum
Pull request #30 (2016-08-21 22:53:16)

Allow pendulum comparison to None.
A comparison between a `Pendulum` object and `None` raises the following error:

``` python
>>> import pendulum
>>> pendulum.now() == None
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/vagrant/.pyenv/versions/server/lib/python2.7/site-packages/pendulum/pendulum.py", line 1129, in __eq__
    return self._datetime == self._get_datetime(other)
  File "/home/vagrant/.pyenv/versions/server/lib/python2.7/site-packages/pendulum/pendulum.py", line 2159, in _get_datetime
    raise ValueError('Invalid datetime "{}"'.format(value))
ValueError: Invalid datetime "None"
```

To fix, I modified `_get_datetime` to return `None` if `value` is `None`.


Patch:
diff --git a/pendulum/pendulum.py b/pendulum/pendulum.py
index ac733e2..ae29828 100644
--- a/pendulum/pendulum.py
+++ b/pendulum/pendulum.py
@@ -2139,6 +2139,9 @@ class Pendulum(datetime.datetime, TranslatableMixin):
 
         :rtype: datetime or Pendulum
         """
+        if value is None:
+            return None
+
         if isinstance(value, Pendulum):
             return value._datetime if not pendulum else value
 


Test patch:
diff --git a/tests/pendulum_tests/test_comparison.py b/tests/pendulum_tests/test_comparison.py
index 8896edd..7561483 100644
--- a/tests/pendulum_tests/test_comparison.py
+++ b/tests/pendulum_tests/test_comparison.py
@@ -65,6 +65,11 @@ class ComparisonTest(AbstractTestCase):
         self.assertNotEqual(d1, d2)
         self.assertEqual(d1, d3)
 
+    def test_not_equal_to_none(self):
+        d1 = Pendulum(2000, 1, 1, 1, 2, 3)
+
+        self.assertNotEqual(d1, None)
+
     def test_greater_than_true(self):
         d1 = Pendulum(2000, 1, 1)
         d2 = Pendulum(1999, 12, 31)
Repository: sdispater/pendulum
Pull request #64 (2016-10-29 08:43:52)

Add validation for days of the week.


Patch:
diff --git a/pendulum/pendulum.py b/pendulum/pendulum.py
index 19f6b46..8ec1ec9 100644
--- a/pendulum/pendulum.py
+++ b/pendulum/pendulum.py
@@ -769,6 +769,8 @@ class Pendulum(datetime.datetime, TranslatableMixin):
 
         :type value: int
         """
+        if value not in cls._days:
+            raise ValueError('Invalid day of the week: {}'.format(value))
         cls._week_starts_at = value
 
     @classmethod
@@ -787,6 +789,8 @@ class Pendulum(datetime.datetime, TranslatableMixin):
 
         :type value: int
         """
+        if value not in cls._days:
+            raise ValueError('Invalid day of the week: {}'.format(value))
         cls._week_ends_at = value
 
     @classmethod
@@ -799,13 +803,17 @@ class Pendulum(datetime.datetime, TranslatableMixin):
         return cls._weekend_days
 
     @classmethod
-    def set_weekend_days(cls, value):
+    def set_weekend_days(cls, values):
         """
         Set weekend days.
 
         :type value: list
         """
-        cls._weekend_days = value
+        for value in values:
+            if value not in cls._days:
+                raise ValueError('Invalid day of the week: {}'
+                                 .format(value))
+        cls._weekend_days = values
 
     # Normalization Rule
     @classmethod


Test patch:
diff --git a/tests/pendulum_tests/test_day_of_week_modifiers.py b/tests/pendulum_tests/test_day_of_week_modifiers.py
index 627bed8..ebd1b66 100644
--- a/tests/pendulum_tests/test_day_of_week_modifiers.py
+++ b/tests/pendulum_tests/test_day_of_week_modifiers.py
@@ -9,6 +9,9 @@ from .. import AbstractTestCase
 
 class DayOfWeekModifiersTest(AbstractTestCase):
 
+    def test_set_weekend_days_invalid_value(self):
+        self.assertRaises(ValueError, Pendulum.set_weekend_days, [7])
+
     def test_get_weekend_days(self):
         self.assertEqual(
             [pendulum.SATURDAY, pendulum.SUNDAY],
@@ -21,11 +24,17 @@ class DayOfWeekModifiersTest(AbstractTestCase):
         )
         Pendulum.set_weekend_days([pendulum.SATURDAY, pendulum.SUNDAY])
 
+    def test_set_week_ends_at_invalid_value(self):
+        self.assertRaises(ValueError, Pendulum.set_week_ends_at, 7)
+
     def test_get_week_ends_at(self):
         Pendulum.set_week_ends_at(pendulum.SATURDAY)
         self.assertEqual(Pendulum.get_week_ends_at(), pendulum.SATURDAY)
         Pendulum.set_week_ends_at(pendulum.SUNDAY)
 
+    def test_set_week_starts_at_invalid_value(self):
+        self.assertRaises(ValueError, Pendulum.set_week_starts_at, 7)
+
     def test_get_week_starts_at(self):
         Pendulum.set_week_starts_at(pendulum.TUESDAY)
         self.assertEqual(Pendulum.get_week_starts_at(), pendulum.TUESDAY)
Repository: sdispater/pendulum
Pull request #66 (2016-10-31 10:16:16)

Fix utcoffset
Usage of tzinfo must have been forgotten when coding this method. It works properly now.

$> python
```
>>> import pendulum
>>> tz = pendulum('Europe/Paris')
>>> tz.utcoffset(pendulum.utcnow())
datetime.timedelta(0, 3600)
```


Patch:
diff --git a/pendulum/tz/timezone.py b/pendulum/tz/timezone.py
index d4fd997..5ad1e53 100644
--- a/pendulum/tz/timezone.py
+++ b/pendulum/tz/timezone.py
@@ -280,7 +280,7 @@ class Timezone(tzinfo):
         elif dt.tzinfo.tz is not self:
             dt = self.convert(dt)
 
-            return dt.adjusted_offset
+            return dt.tzinfo.adjusted_offset
 
         return dt.utcoffset(dt)
 


Test patch:
diff --git a/tests/tz_tests/test_timezone.py b/tests/tz_tests/test_timezone.py
index 71d5aed..3169806 100644
--- a/tests/tz_tests/test_timezone.py
+++ b/tests/tz_tests/test_timezone.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import pendulum
-from datetime import datetime
+from datetime import datetime, timedelta
 from pendulum import timezone
 from pendulum.tz.exceptions import NonExistingTime, AmbiguousTime
 
@@ -146,3 +146,8 @@ class TimezoneTest(AbstractTestCase):
         self.assertEqual('Europe/Paris', dt.timezone_name)
         self.assertEqual(3600, dt.offset)
         self.assertFalse(dt.is_dst)
+
+    def test_utcoffset(self):
+        tz = pendulum.timezone('Europe/Paris')
+        utcoffset = tz.utcoffset(pendulum.utcnow())
+        self.assertEqual(utcoffset, timedelta(0, 3600))
Repository: sdispater/pendulum
Pull request #89 (2017-01-26 15:56:58)

Fixing missing parentheses in method day_of_year
Hello,

Sounds like you forgot some parentheses in method day_of_year.

First when using is_leap_year method and after when computing nb days.

Regards,

Laurent

asrenzo: Tests added
sdispater: Thanks. However, the tests you added pass even without the fix so it won't prevent any regression.

I suggest using December 31 as the day to be sure to get a date that triggers the error since it currently returns 364 for a non-leap year instead of 365.

Also, could you put the tests in [tests/date_tests/test_getters.py](https://github.com/sdispater/pendulum/blob/master/tests/date_tests/test_getters.py) since it's where `day_of_year` and other getters tests are already?
sdispater: Looks good to me :-) Thanks!

Patch:
diff --git a/pendulum/date.py b/pendulum/date.py
index 4dcf448..627fc0f 100644
--- a/pendulum/date.py
+++ b/pendulum/date.py
@@ -137,11 +137,11 @@ class Date(TranslatableMixin, FormattableMixing, TestableMixin, date):
 
         :rtype: int
         """
-        k = 1 if self.is_leap_year else 2
+        k = 1 if self.is_leap_year() else 2
 
         return (
             (275 * self.month) // 9
-            - k * (self.month + 9) // 12
+            - k * ((self.month + 9) // 12)
             + self.day - 30
         )
 


Test patch:
diff --git a/tests/date_tests/test_getters.py b/tests/date_tests/test_getters.py
index 18fde22..2a37f21 100644
--- a/tests/date_tests/test_getters.py
+++ b/tests/date_tests/test_getters.py
@@ -25,8 +25,10 @@ class GettersTest(AbstractTestCase):
         self.assertEqual(pendulum.MONDAY, d.day_of_week)
 
     def test_day_of_year(self):
-        d = Date(2012, 5, 7)
-        self.assertEqual(128, d.day_of_year)
+        d = Date(2015, 12, 31)
+        self.assertEqual(365, d.day_of_year)
+        d = Date(2016, 12, 31)
+        self.assertEqual(366, d.day_of_year)
 
     def test_days_in_month(self):
         d = Date(2012, 5, 7)
Repository: sdispater/pendulum
Pull request #102 (2017-03-20 05:14:43)

New Parser Behavior for ":" separator in date formats
Per sdispater/pendulum#101, implements exif format (: as separator in date formats) to regex parser

- [x] Add functional test for new expected parse functionality
- [x] Test COMMON regex alteration against prior test suite

sdispater: I like it!

However, I don't see it as a bugfix but rather as a new feature (parsing of exif format), so it might be better to base this on the `develop` branch which is where new, non-breaking feature should be.
SethMichaelLarson: Agreed.
emattiza: cleaned up and rebased onto develop. Appreciate the feedback guys!

Patch:
diff --git a/pendulum/parsing/parser.py b/pendulum/parsing/parser.py
index c8de3c9..0372e8a 100644
--- a/pendulum/parsing/parser.py
+++ b/pendulum/parsing/parser.py
@@ -21,8 +21,8 @@ class Parser(object):
         '    (?P<classic>'  # Classic date (YYYY-MM-DD) or ordinal (YYYY-DDD)
         '        (?P<year>\d{4})'  # Year
         '        (?P<monthday>'
-        '            (?P<monthsep>-|/)?(?P<month>\d{2})'  # Month (optional)
-        '            ((?P<daysep>-|/)?(?P<day>\d{1,2}))?'  # Day (optional)
+        '            (?P<monthsep>[-/:])?(?P<month>\d{2})'  # Month (optional)
+        '            ((?P<daysep>[-/:])?(?P<day>\d{1,2}))?'  # Day (optional)
         '        )?'
         '    )'
         '    |'


Test patch:
diff --git a/tests/parsing_test/test_parser.py b/tests/parsing_test/test_parser.py
index 8ec59c2..d077004 100644
--- a/tests/parsing_test/test_parser.py
+++ b/tests/parsing_test/test_parser.py
@@ -561,3 +561,15 @@ class ParserTest(AbstractTestCase):
         text = '2012-W13-8'
 
         self.assertRaises(ParserError, Parser().parse, text)
+
+    def test_exif_edge_case(self):
+        text = '2016:12:26 15:45:28'
+
+        parsed = Parser().parse(text)
+
+        self.assertEqual(2016, parsed['year'])
+        self.assertEqual(12, parsed['month'])
+        self.assertEqual(26, parsed['day'])
+        self.assertEqual(15, parsed['hour'])
+        self.assertEqual(45, parsed['minute'])
+        self.assertEqual(28, parsed['second'])
Repository: sdispater/pendulum
Pull request #108 (2017-04-29 23:23:52)

When creating without tzinfo, preserve fold value.
When creating a new Pendulum instance without passing in a TimezoneInfo object and using python 3.6, the internal fold parameter was not correct.  In this scenario, self._fold was being set based on the fold parameter in the underlying datetime object.  When using python3.6, this value exists, but is always set to 0 since Pendulum is not passing the fold parameter to the datetime constructor.

 - Changed self._fold to always be set based on the internal fold variable.
 - Added checks to the existing unit tests to verify that the fold parameter is being preserved.

All tests pass with python 3.6.1, did not test with any other versions.


Patch:
diff --git a/pendulum/pendulum.py b/pendulum/pendulum.py
index 431d995..119c662 100644
--- a/pendulum/pendulum.py
+++ b/pendulum/pendulum.py
@@ -176,7 +176,7 @@ class Pendulum(Date, datetime.datetime):
             self._second = dt.second
             self._microsecond = dt.microsecond
             self._tzinfo = dt.tzinfo
-            self._fold = getattr(dt, 'fold', fold)
+            self._fold = fold
 
         self._timestamp = None
         self._int_timestamp = None


Test patch:
diff --git a/tests/pendulum_tests/test_construct.py b/tests/pendulum_tests/test_construct.py
index b7dcc4b..35d3fac 100644
--- a/tests/pendulum_tests/test_construct.py
+++ b/tests/pendulum_tests/test_construct.py
@@ -202,6 +202,8 @@ class ConstructTest(AbstractTestCase):
 
         d = Pendulum(2013, 3, 31, 2, 30, tzinfo='Europe/Paris', fold=0)
         self.assertPendulum(d, 2013, 3, 31, 1, 30)
+        self.assertEqual(d.fold, 0)
 
         d = Pendulum(2013, 3, 31, 2, 30, tzinfo='Europe/Paris', fold=1)
         self.assertPendulum(d, 2013, 3, 31, 3, 30)
+        self.assertEqual(d.fold, 1)
Repository: sdispater/pendulum
Pull request #858 (2024-11-05 15:13:25)

Update Korean Translations for Before/After Context
## Translation simply update
 Fixed Korean before/after translations.



Patch:
diff --git a/src/pendulum/locales/ko/custom.py b/src/pendulum/locales/ko/custom.py
index b7476ff..c3546b7 100644
--- a/src/pendulum/locales/ko/custom.py
+++ b/src/pendulum/locales/ko/custom.py
@@ -6,8 +6,8 @@ from __future__ import annotations
 
 translations = {
     # Relative time
-    "after": "{0} 뒤",
-    "before": "{0} 앞",
+    "after": "{0} 후",
+    "before": "{0} 전",
     # Date formats
     "date_formats": {
         "LTS": "A h시 m분 s초",
diff --git a/src/pendulum/parsing/__init__.py b/src/pendulum/parsing/__init__.py
index 761f52c..60b232b 100644
--- a/src/pendulum/parsing/__init__.py
+++ b/src/pendulum/parsing/__init__.py
@@ -214,11 +214,11 @@ def _parse_iso8601_interval(text: str) -> _Interval:
     first, last = text.split("/")
     start = end = duration = None
 
-    if first[0] == "P":
+    if first[:1] == "P":
         # duration/end
         duration = parse_iso8601(first)
         end = parse_iso8601(last)
-    elif last[0] == "P":
+    elif last[:1] == "P":
         # start/duration
         start = parse_iso8601(first)
         duration = parse_iso8601(last)


Test patch:
diff --git a/tests/localization/test_ko.py b/tests/localization/test_ko.py
index c03a372..d036f78 100644
--- a/tests/localization/test_ko.py
+++ b/tests/localization/test_ko.py
@@ -59,8 +59,8 @@ def diff_for_humans():
 
     d = pendulum.now().add(seconds=1)
     d2 = pendulum.now()
-    assert d.diff_for_humans(d2, locale=locale) == "1초 뒤"
-    assert d2.diff_for_humans(d, locale=locale) == "1초 앞"
+    assert d.diff_for_humans(d2, locale=locale) == "1초 후"
+    assert d2.diff_for_humans(d, locale=locale) == "1초 전"
 
     assert d.diff_for_humans(d2, True, locale=locale) == "1초"
     assert d2.diff_for_humans(d.add(seconds=1), True, locale=locale) == "2초"
diff --git a/tests/parsing/test_parsing.py b/tests/parsing/test_parsing.py
index d57b82f..ce530c3 100644
--- a/tests/parsing/test_parsing.py
+++ b/tests/parsing/test_parsing.py
@@ -660,6 +660,16 @@ def test_invalid():
     with pytest.raises(ParserError):
         parse(text)
 
+    text = "/2012"
+
+    with pytest.raises(ParserError):
+        parse(text)
+
+    text = "2012/"
+
+    with pytest.raises(ParserError):
+        parse(text)
+
 
 def test_exif_edge_case():
     text = "2016:12:26 15:45:28"
Repository: ruma/ruma
Pull request #103 (2020-07-01 18:58:50)

Add trybuild tests for the ruma_api! macro

jimmycuadra: This error code isn't in the spec, so it'd need to be `IO_RUMA_INVALID_PARAM`.

Patch:
diff --git a/ruma-api/Cargo.toml b/ruma-api/Cargo.toml
index fd02984c..29b7c425 100644
--- a/ruma-api/Cargo.toml
+++ b/ruma-api/Cargo.toml
@@ -27,3 +27,4 @@ strum = "0.18.0"
 
 [dev-dependencies]
 ruma-events = { version = "0.21.3", path = "../ruma-events" }
+trybuild = "1.0.30"


Test patch:
diff --git a/ruma-api/tests/ruma_api.rs b/ruma-api/tests/ruma_api.rs
new file mode 100644
index 00000000..f56f5a1e
--- /dev/null
+++ b/ruma-api/tests/ruma_api.rs
@@ -0,0 +1,5 @@
+#[test]
+fn ui() {
+    let t = trybuild::TestCases::new();
+    t.pass("tests/ui/01-api-sanity-check.rs");
+}
diff --git a/ruma-api/tests/ui/01-api-sanity-check.rs b/ruma-api/tests/ui/01-api-sanity-check.rs
new file mode 100644
index 00000000..29ffcdaa
--- /dev/null
+++ b/ruma-api/tests/ui/01-api-sanity-check.rs
@@ -0,0 +1,52 @@
+use ruma_api::ruma_api;
+use ruma_events::{tag::TagEvent, AnyRoomEvent, EventJson};
+
+ruma_api! {
+    metadata: {
+        description: "Does something.",
+        method: POST, // An `http::Method` constant. No imports required.
+        name: "some_endpoint",
+        path: "/_matrix/some/endpoint/:baz",
+        rate_limited: false,
+        requires_authentication: false,
+    }
+
+    request: {
+        // With no attribute on the field, it will be put into the body of the request.
+        pub foo: String,
+
+        // This value will be put into the "Content-Type" HTTP header.
+        #[ruma_api(header = CONTENT_TYPE)]
+        pub content_type: String,
+
+        // This value will be put into the query string of the request's URL.
+        #[ruma_api(query)]
+        pub bar: String,
+
+        // This value will be inserted into the request's URL in place of the
+        // ":baz" path component.
+        #[ruma_api(path)]
+        pub baz: String,
+    }
+
+    response: {
+        // This value will be extracted from the "Content-Type" HTTP header.
+        #[ruma_api(header = CONTENT_TYPE)]
+        pub content_type: String,
+
+        // With no attribute on the field, it will be extracted from the body of the response.
+        pub value: String,
+
+        // You can use serde attributes on any kind of field
+        #[serde(skip_serializing_if = "Option::is_none")]
+        pub optional_flag: Option<bool>,
+
+        // Use `EventJson` instead of the actual event to allow additional fields to be sent...
+        pub event: EventJson<TagEvent>,
+
+        // ... and to allow unknown events when the endpoint deals with event collections.
+        pub list_of_events: Vec<EventJson<AnyRoomEvent>>,
+    }
+}
+
+fn main() {}
Repository: knex/knex
Pull request #4781 (2021-10-29 12:57:59)

Support fromRaw
- Finish https://github.com/knex/knex/pull/4429 to add 'fromRaw' (@elhigu).
- Closes https://github.com/knex/knex/issues/1767

kibertoad: Thanks!

Patch:
diff --git a/lib/query/method-constants.js b/lib/query/method-constants.js
index 2b939d5b..ab637c89 100644
--- a/lib/query/method-constants.js
+++ b/lib/query/method-constants.js
@@ -9,6 +9,7 @@ module.exports = [
   'column',
   'from',
   'fromJS',
+  'fromRaw',
   'into',
   'withSchema',
   'table',
diff --git a/lib/query/querybuilder.js b/lib/query/querybuilder.js
index 31737900..ee05a4af 100644
--- a/lib/query/querybuilder.js
+++ b/lib/query/querybuilder.js
@@ -1266,6 +1266,11 @@ class Builder extends EventEmitter {
     return this;
   }
 
+  fromRaw(sql, bindings) {
+    const raw = sql.isRawInstance ? sql : this.client.raw(sql, bindings);
+    return this.from(raw);
+  }
+
   // Passes query to provided callback function, useful for e.g. composing
   // domain-specific helpers
   modify(callback) {
diff --git a/types/index.d.ts b/types/index.d.ts
index a726ed3f..bb32ecd9 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -491,6 +491,7 @@ export declare namespace Knex {
     column: Select<TRecord, TResult>;
     hintComment: HintComment<TRecord, TResult>;
     from: Table<TRecord, TResult>;
+    fromRaw: Table<TRecord, TResult>;
     into: Table<TRecord, TResult>;
     table: Table<TRecord, TResult>;
     distinct: Distinct<TRecord, TResult>;


Test patch:
diff --git a/test/unit/query/builder.js b/test/unit/query/builder.js
index 99655e95..abe7c34b 100644
--- a/test/unit/query/builder.js
+++ b/test/unit/query/builder.js
@@ -8421,6 +8421,15 @@ describe('QueryBuilder', () => {
     );
   });
 
+  it('uses fromRaw api, #1767', () => {
+    testsql(qb().select('*').fromRaw('(select * from users where age > 18)'), {
+      mysql: 'select * from (select * from users where age > 18)',
+      mssql: 'select * from (select * from users where age > 18)',
+      pg: 'select * from (select * from users where age > 18)',
+      'pg-redshift': 'select * from (select * from users where age > 18)',
+    });
+  });
+
   it('has a modify method which accepts a function that can modify the query', () => {
     // arbitrary number of arguments can be passed to `.modify(queryBuilder, ...)`,
     // builder is bound to `this`
Repository: knex/knex
Pull request #4788 (2021-10-30 21:36:37)

Zero precision in timestamp/datetime #4784 (#4786)
(cherry picked from commit a431485aa6308aa2e9046f89b9216e7057caaa29)


Patch:
diff --git a/lib/dialects/postgres/schema/pg-columncompiler.js b/lib/dialects/postgres/schema/pg-columncompiler.js
index cc49f883..5fb7fa25 100644
--- a/lib/dialects/postgres/schema/pg-columncompiler.js
+++ b/lib/dialects/postgres/schema/pg-columncompiler.js
@@ -72,22 +72,16 @@ class ColumnCompiler_PG extends ColumnCompiler {
       useTz = !withoutTz;
     }
     useTz = typeof useTz === 'boolean' ? useTz : true;
-    precision = precision ? '(' + precision + ')' : '';
+    precision =
+      precision !== undefined && precision !== null
+        ? '(' + precision + ')'
+        : '';
 
     return `${useTz ? 'timestamptz' : 'timestamp'}${precision}`;
   }
 
   timestamp(withoutTz = false, precision) {
-    let useTz;
-    if (isObject(withoutTz)) {
-      ({ useTz, precision } = withoutTz);
-    } else {
-      useTz = !withoutTz;
-    }
-    useTz = typeof useTz === 'boolean' ? useTz : true;
-    precision = precision ? '(' + precision + ')' : '';
-
-    return `${useTz ? 'timestamptz' : 'timestamp'}${precision}`;
+    return this.datetime(withoutTz, precision);
   }
 
   // Modifiers:


Test patch:
diff --git a/test/unit/schema-builder/postgres.js b/test/unit/schema-builder/postgres.js
index 48ca1996..2caee2ac 100644
--- a/test/unit/schema-builder/postgres.js
+++ b/test/unit/schema-builder/postgres.js
@@ -1528,6 +1528,19 @@ describe('PostgreSQL SchemaBuilder', function () {
     );
   });
 
+  it('adding timestamp with options object but precision 0 - #4784', () => {
+    tableSql = client
+      .schemaBuilder()
+      .table('users', (table) => {
+        table.timestamp('foo', { useTz: false, precision: 0 });
+      })
+      .toSQL();
+    equal(1, tableSql.length);
+    expect(tableSql[0].sql).to.equal(
+      'alter table "users" add column "foo" timestamp(0)'
+    );
+  });
+
   it('adding datetime with options object', () => {
     tableSql = client
       .schemaBuilder()
@@ -1567,6 +1580,19 @@ describe('PostgreSQL SchemaBuilder', function () {
     );
   });
 
+  it('adding datetime with options object but precision 0 - #4784', () => {
+    tableSql = client
+      .schemaBuilder()
+      .table('users', (table) => {
+        table.datetime('foo', { useTz: false, precision: 0 });
+      })
+      .toSQL();
+    equal(1, tableSql.length);
+    expect(tableSql[0].sql).to.equal(
+      'alter table "users" add column "foo" timestamp(0)'
+    );
+  });
+
   it('adding timestamps', () => {
     tableSql = client
       .schemaBuilder()