Commit 83f59795 authored by William Naslund's avatar William Naslund

fixed datetime type name in postgres

parent a72ef9a8
......@@ -11,7 +11,7 @@ export class DBDate implements DBType {
export class DBDateTime implements DBType {
create() {
return `TIMESTAMP WITH TIMEZONE`;
return `TIMESTAMPTZ`;
}
}
import * as assert from "assert";
import * as uuid from "uuid/v4"
import { Database, DBTable, DBModel, DBBlob, DBTableConstraint, DBUniqueConstraint, DBField } from "@swirl/db";
import { Database, DBTable, DBModel, DBBlob, DBTableConstraint, DBUniqueConstraint, DBField, DBDateTime } from "@swirl/db";
import { getTestAdapter } from "./db/adapter";
import { Account } from "./db/account";
import { Contact } from "./db/contact";
......@@ -49,6 +49,31 @@ describe('DBType (Implementations)', function() {
});
describe('DBDateTime', function() {
@DBTable('tmp')
class TMP extends DBModel {
@DBField('test', new DBDateTime())
public test: Date;
}
it('stores a date and time', async () => {
await db.register(TMP).migrate();
const record = new TMP();
record.test = new Date(2019, 2 - 1, 12, 9, 5, 13);
await record.insert();
let res = await db.adapter.command.query(`
SELECT *
FROM tmp
`);
});
});
afterEach('Reset the database', async () => {
await db.delete();
await db.close();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment