我目前拥有:
CREATE TABLE galleries_gallery (
id INT NOT NULL PRIMARY KEY IDENTITY,
title NVARCHAR(50) UNIQUE NOT NULL,
description VARCHAR(256),
templateID INT NOT NULL REFERENCES galleries_templates(id),
jsAltImgID INT NOT NULL REFERENCES libraryImage(id)
jsAltText NVARCHAR(500),
dateCreated SMALLDATETIME NOT NULL,
dateUpdated SMALLDATETIME NOT NULL,
lastUpdatedBy INT,
deleted BIT NOT NULL DEFAULT 0
);
但这会增加自动生成名称的限制,使得以后难以删除约束。我需要添加什么来命名约束?
上面的示例是SQL Server,我还需要在PostgreSQL中使用。
rowguid uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT DF_PurchaseOrderDetail_rowguid DEFAULT (newid())
- Hiten004