Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pypika/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class SqlTypes:
NUMERIC = "NUMERIC"
SIGNED = "SIGNED"
UNSIGNED = "UNSIGNED"
INTEGER_AUTO_INCREMENT = "INTEGER AUTO_INCREMENT"

DATE = "DATE"
TIME = "TIME"
Expand Down
9 changes: 8 additions & 1 deletion pypika/tests/test_create.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest

from pypika import Column, Columns, Query, Table, Tables
from pypika.enums import ReferenceOption
from pypika.enums import ReferenceOption, SqlTypes
from pypika.terms import Index, ValueWrapper


Expand Down Expand Up @@ -124,6 +124,13 @@ def test_create_table_with_columns(self):

self.assertEqual('CREATE TABLE IF NOT EXISTS "abc" ("a" INT,"b" VARCHAR(100))', str(q))

with self.subTest("with primary key & auto increment"):
a = Column("a", SqlTypes.INTEGER_AUTO_INCREMENT, False)
b = Column("b", "VARCHAR(100)", default="foo")
q = Query.create_table(self.new_table).columns(a, b).primary_key(a)

self.assertEqual('CREATE TABLE "abc" ("a" INTEGER AUTO_INCREMENT NOT NULL,"b" VARCHAR(100) DEFAULT \'foo\',PRIMARY KEY ("a"))', str(q))

def test_create_table_with_select(self):
select = Query.from_(self.existing_table).select(self.existing_table.foo, self.existing_table.bar)

Expand Down
Loading