mirror of
https://github.com/ent/ent.git
synced 2026-05-01 15:10:57 +03:00
ent: allow non-numeric columns as PKs
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/180 Reviewed By: alexsn Differential Revision: D18636443 fbshipit-source-id: f14b34926817f6d9652f49a640bfb377f3f3cdaf
This commit is contained in:
committed by
Facebook Github Bot
parent
bc4284cf2c
commit
e54373f410
@@ -75,9 +75,10 @@ func (d *SQLite) tBuilder(t *Table) *sql.TableBuilder {
|
||||
for _, fk := range t.ForeignKeys {
|
||||
b.ForeignKeys(fk.DSL())
|
||||
}
|
||||
// if it's an ID based primary key, we add the `PRIMARY KEY`
|
||||
// clause to the column declaration.
|
||||
if len(t.PrimaryKey) == 1 {
|
||||
// If it's an ID based primary key with autoincrement, we add
|
||||
// the `PRIMARY KEY` clause to the column declaration. Otherwise,
|
||||
// we append it to the constraint clause.
|
||||
if len(t.PrimaryKey) == 1 && t.PrimaryKey[0].Increment {
|
||||
return b
|
||||
}
|
||||
for _, pk := range t.PrimaryKey {
|
||||
|
||||
Reference in New Issue
Block a user