Skip to content

Instantly share code, notes, and snippets.

@radityopw
Created August 2, 2020 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radityopw/93732a9e895f325ea56f1ba1e4fc6c1b to your computer and use it in GitHub Desktop.
Save radityopw/93732a9e895f325ea56f1ba1e4fc6c1b to your computer and use it in GitHub Desktop.
CREATE TABLE [dbo].[pegawai](
[id] [int] IDENTITY(1,1) NOT NULL,
[nama] [varchar](20) NOT NULL,
[jenis_kelamin] [char](1) NOT NULL,
[create_at] [datetime] NOT NULL,
[update_at] [datetime] NOT NULL,
CONSTRAINT [PK_pegawai] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[pegawai] ADD CONSTRAINT [DF_pegawai_create_at] DEFAULT (getdate()) FOR [create_at]
GO
ALTER TABLE [dbo].[pegawai] ADD CONSTRAINT [DF_pegawai_update_at] DEFAULT (getdate()) FOR [update_at]
GO
CREATE TABLE [dbo].[pegawai_log](
[id] [int] IDENTITY(1,1) NOT NULL,
[id_pegawai] [int] NOT NULL,
[operasi] [varchar](50) NOT NULL,
[status] [varchar](10) NOT NULL,
[message] [varchar](50) NULL,
[create_at] [datetime] NOT NULL,
[update_at] [datetime] NOT NULL,
CONSTRAINT [PK_pegawai_log] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[pegawai_log] ADD CONSTRAINT [DF_pegawai_log_create_at] DEFAULT (getdate()) FOR [create_at]
GO
ALTER TABLE [dbo].[pegawai_log] ADD CONSTRAINT [DF_pegawai_log_update_at] DEFAULT (getdate()) FOR [update_at]
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment